27. Looks For-In to me - URGENT

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/en/courses/objects-ii/5/1?curriculum_id=506324b3a7dffd00020bf661#

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Hi everyone, please see my code in below. Instead of saying an if they are “string”, I was trying to say if they are NOT NUMBER. However, I don’t know why the system is not allowing me to pass?

Can someone help me?

```

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

// print hello in the 3 different languages
for (var x in languages) {
var x = languages;
if (typeof x === !“number”) {
console.log(x);
}
};

<do not remove the three backticks above>

Here is where the error is coming from instead of,

Just type in,

if (typeof x === "string")

Is not number.

if (typeof languages[i] !== "number") {

}

I think you meant to address :sweat_smile: @jim_prince

Thank you! It works and I understand it now.

1 Like

If you guys are wondering why he had the error in the first place, it’s because the exercise’s instructions said explicitly to “check if the type was a “string””

This is my answer:
for(var x in languages){
var x=languages
if(typeof x==“string”){
console.log(x);
}
}

for(var x in languages){
var x=languages
if(typeof x==“string”){
console.log(x);
}
}

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