27/30 Where am I wrong?


#1

Sorry to ask you to find a silly bug in my program but I am simply unable to undertsand why the error is coming....

it says something like this.... Oops, try again.
It looks like you didn't print Hello!

the code is...

var languages = {
english: "Hello!",
french: "Bonjour!",
notALanguage: 4,
spanish: "Hola!"
};

// print hello in the 3 different languages
for(var stringCheck in languages)
{
if(typeof languages.stringCheck === 'string')
{
console.log(languages.stringCheck);
}
}


#2

Try to use bracket notation. Like this:


#3

:grinning:

var languages = {
    english: "Hello!",
    french: "Bonjour!",
    notALanguage: 4,
    spanish: "Hola!"
};

// print hello in the 3 different languages
for (var i in languages) {
    if (typeof (languages[i]) === "string") {
        console.log(languages[i]);
    }
}