27. I can not find my mistakes help me!


#1



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

// print hello in the 3 different languages

for (var x in languages) {
if (typeof languages[x] == "string") {
console.log(languages[x]);
} else {
console.log(" ");
}
};


#2

@ericentrepreneur,
Try it by removing the ELSE

else {
console.log(" ");
}

#3

removed as you said. but it is still not working....


#4

@ericentrepreneur,
Could you present the code you are using now....
or maybe a reset Browser is needed...

++++ reset of session *****************
As you are manipulating with objects
under certain circumstances you can shoot your Browser in an
inconsistent state.

Therefor it is of an advantage to know that you have 2 reset facilities:

One is the use of the F5-key which does a refresh Browser

and

Two, select&copy your code
Then use the Reset Code button of the course-window,
then paste your code back in.

Addendum
General Notes:
Always refresh the browser after making corrections:
CTRL f5 ( if on Windows or Linux)
CMD r ( if on a MAC).
CTRL 0 to reset browser zoom


#5

Your original code is correct refresh your page and try again :slight_smile:
Or reset lesson (past in)and try again


#6

Is the console.log(" "); strictly needed? I managed to get it to work on the if statement alone, without an "else".


#7

Hey there! Try this code!
var languages = {
english: "Hello!",
french: "Bonjour!",
notALanguage: 4,
spanish: "Hola!"
};

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