Codecademy Intro to Objects Review: The Story So Far Answer

Someone e-mailed and asked for help on this section, so here’s my source code / answer.

Section 1.3: …And the good!

/*
Michael Le (username: mikele)
Codecademy Answers / Source Code
Introduction to Objects:
1.3 Review: ...And the good!
*/
//for loop iterating from 1-20
for(i=1;i<=20;i++){
    
    if(i%3===0){
        //if divisible by 3 and 5 print FizzBuzz
        if(i%5===0)
            console.log("FizzBuzz");
            
        else
            console.log("Fizz");
    }
    else if(i%5===0)
        console.log("Buzz");
    //if not divisible by 3 nor 5 print the number
    else
        console.log(i);
}

1.4 I have to celebrate you baby answer / source code

/*
Michael Le (username: mikele)
Codecademy Answers / Source Code
Javascript Intro to Objects I:
1.4 I have to celebrate you baby.
*/
var getReview = function (movie) {

//use switch statement
switch(movie){
    
    //because you are using RETURN, you do not need BREAK;
    case "Matrix":
        return "good trip out";
    
    case "Princess Bride":
        return "awesome date night movie";
    
    case "Welcome to America":
        return "Amjad's favorite";
    
    case "Remember the Titans":
        return "love the sports";
    
    case "Why do I look like I'm 12?":
        return "The Ryan and Zach Story";
    
    case "Fighting Kangaroos in the wild":
        return "Token Australian movie for Leng";
    
    default:
        return "I don't know!";
    
}
}
Show Comments