I\'m working on a codecademy.com exercise where we use for-in statements to loop through an object and print hello in different languages by checking to see if the values of the
You are checking keys of the object, not the value. It's usually a good practice to check against the constructor of an object to determine its type.
Something like this:
var languages = {
english: "Hello!",
french: "Bonjour!",
notALanguage: 4,
spanish: "Hola!"
};
for(i in languages) {
if(languages[i].constructor === String) {
console.log(languages[i])
};
};