Last active
February 21, 2017 15:10
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertHTML (str) { | |
let loopString = str | |
for (let char of loopString) { | |
console.log(char) | |
switch (char) { | |
case '<': | |
char = '<' | |
break | |
case '&': | |
char.char = '&' | |
break | |
case '>': | |
char = '>' | |
break | |
case '"': | |
char = '"' | |
break | |
case "'": | |
char = '&apos' | |
break | |
} | |
} | |
loopString.split('') | |
return loopString | |
} | |
convertHTML('Dolce & Gabbana') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment