27. Looks For-In To Me


#1

https://www.codecademy.com/en/courses/objects-ii/5/1?curriculum_id=506324b3a7dffd00020bf661#

Oops, try again. It looks like you printed 4 when you shouldn't have!

I can't seem to figure out what I am doing wrong...

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

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

#2

Nevermind, I figured it out...

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

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

#3

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