Looks For-In To Me


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

// print hello in the 3 different languages
for(var x in languages) {

if( typeof x  === "string" ){


Don't know what is wrong ....


Structure of a for/in loop is:

for __ in _______{}


This is what i wrote didn't I ?


Wait... never mind, you did it correctly (comparing mine to yours :smiley:). Except in your if statement:

You need to show where the x is from, which is languages. Soooo...

if(typeof languages[x] === "string"){


Yes that's what I found thinking of it twice :bulb:

Thanks anyway :grinning:


what is the difference between

languages.x & languages[x] ?


I don't believe that there's a difference. Both are called the dot notation and the bracket notation, and both call a key/property of the object. So, no, there's no difference.


ı think there is a differance in using at loop


languages.x & languages[x] are the same fucntionally.

However there is a slight advantage for the bracket notation for being able to call a function.

For example, if x is a function, languages[x] would be able to call x as a function whereas languages.x wouldn't be able to.