Convert a select few HTML Entities

Tell us what’s happening:
one of those coding exercises
Intermediate Algorithm Scripting: Convert HTML Entities

Your code so far

function convertHTML(str) {
  const map = new Map();
    map.set('&', '&​amp;')
    map.set('\'', '&​apos;')
  return str.split('')
            .map( (char) => map.has(char) ? map.get(char) : char)

console.log(convertHTML("Schindler's List"));

Link to the challenge:

:thinking: You has copied not visible chars. Try replace it in your code. Avoid copy and paste.

1 Like