Suggestion to add an additional "Helpful Link" to the "Convert HTML Entities" challenge
See original GitHub issueChallenge Convert HTML Entities.
Before I submit a PR, I’d like to get feedback on adding an additional link to reference on this challenge.
I might be wrong but I think this is the first exposure users have to regular expressions in the track so I think it would be helpful to also include a reference to .replace() which makes solving this challenge much more manageable for new coders.
Example solution:
function convert(str) {
// The list of chars to convert
var charHTMLlist = {
"&" : "&",
"<" : "<",
">" : ">",
'"' : """,
"'" : "'"
};
// Char replacement function triggered when a match is found
function charHTMLmapper(ch){
return charHTMLlist[ch];
}
// Returns a new string with the encode matches
return str.replace(/[&"'<>]/g, charHTMLmapper);
}
// returns "Dolce & Gabbana"
convert("Dolce & Gabbana");
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
convert HTML entities FreeCodeCamp challenge - YouTube
A character entity is a code used to represent a character that doesn't belong to the document's character set.
Read more >freeCodeCamp Challenge Guide: Convert HTML Entities
You have to create a program that will convert HTML entities from string to their corresponding HTML entities. There are only a few...
Read more >Solving "Convert HTML Entities" / freeCodeCamp Algorithm ...
Let's solve freeCodeCamp's intermediate algorithm scripting challenge, 'Convert HTML Entities'. Starter Code. function convertHTML(str) { return ...
Read more >Convert HTML Entities - Medium
We need to convert the characters &, <, >, " (double quote), and ' (apostrophe), in a string to their corresponding HTML entities....
Read more >How to decode HTML entities using jQuery? - Stack Overflow
These is the best way to decode HTML entities. All other answers (on this and similar questions) either use innerHTML (create new HTML...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@williamsolivera go for it! 👍 Please read the contributing guidelines if you haven’t already before taking care of the issue. And don’t hesitate to visit the Contributors Help if you have any questions about helping. They are pretty responsive and friendly!
I’d love to do this change as my first contribution!