Tell us what’s happening:
The console.log test in the end, proves that the code if working correctly. But when I run it, it fails on those exact two tests:
-
convertHTML('Stuff in "quotation marks"')
should returnStuff in "quotation marks"
. -
convertHTML("Schindler's List")
should returnSchindler's List
.
Is there a bug in this challenge?
Thank you for your help!
Your code so far
function convertHTML(str) {
let newStr = "";
function monaPaTaka (input) {
let splitStr = input.split("");
console.log(splitStr);
for (let j = 0; j < splitStr.length; j++) {
if (splitStr[j] === "&") {
splitStr[j] = "&";
}
if (splitStr[j] === "<") {
splitStr[j] = "<";
}
if (splitStr[j] === ">") {
splitStr[j] = ">";
}
if (splitStr[j] === '"') {
splitStr[j] = '"';
}
if (splitStr[j] === "'") {
splitStr[j] = "'";
}
}
newStr = splitStr.join("");
console.log(newStr);
}
monaPaTaka(str);
return newStr;
}
convertHTML('Stuff in "quotation marks"');
convertHTML("Schindler's List");
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
.
Link to the challenge: