Convert HTML Entities - 7/17/2018

Tell us what’s happening:
I must be missing something small here. The code outputs everything clearly on my Visual Studio program, but when I run this in the FCC test, it doesn’t pass for some reason.

Anyone know why?

Your code so far

function convertHTML(str) {
    // :)
    let array = str.split('');

 //   console.log(array);

    for (let i=0; i<array.length;++i){
        switch (array[i]) {
            case '&': 
                array[i] = "&​amp;";
            case '<':
                array[i] = "&​lt;";
            case '>':
                array[i] = "&​gt;";
            case '"':
                array[i] = "&​quot;";
            case "'":
                array[i] = "&​apos;";

    array = array.join('');

    return array;

//test here
convertHTML("Dolce & Gabbana");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:

Your code is fine but I think the way you copied it into the challenge caused an invisible problem.

Somehow you picked up some formatting extras along the way (see pic below by the cursor). These did not show up in the challenge editor though


I could not see anything wrong with your output but on a whim I pasted your code into another editor. Once I removed the ‘dot’ your code ran fine in the challenge.

Hey thanks alhezen1 !

I thought the code was fine but was thoroughly confused when it didn’t pass the check. That makes sense, sometimes copy and paste creates odd characters.