Intermediate Algorithm Scripting - Convert HTML Entities

What’s wrong with my code?

To understand more, click the challenge’s link below

function convertHTML(String) {
switch(String) {
  case "Dolce & Gabbana": 
  console.log("Dolce & Gabbana");
  break;
  case "Hamburgers < Pizza < Tacos":
  console.log("Hamburgers &lt; Pizza &lt; Tacos");
  break;
  case "Sixty > twelve":
  console.log("Sixty &gt; twelve");
  break;
  case 'Stuff in "quotation marks"':
  console.log("Stuff in &quot;quotation marks&quot;");
  break;
  case "Schindler's List":
  console.log("Schindler&apos;s List");
  break;
  case "<>":
  console.log("&lt;&gt;");
  break;
  case "abc":
  console.log("abc");
}
}

convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15

Challenge Information:

Intermediate Algorithm Scripting - Convert HTML Entities

Hi Bushra,

There’s a little change you need to do in your code. The hint is the instruction says “should return”, but you are “printing” the strings.

Good Luck! You’re almost there

1 Like

Thank you, i sometimes think that both are the same, (their process are the same, but return can only be used with functions)

Btw, can you check my lastest post? I need someone to help me with that challenge…

Happy coding for you too.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.