Introduction to Objects I 4/33


#1

https://www.codecademy.com/courses/spencer-sandbox/0/4?curriculum_id=506324b3a7dffd00020bf661#
syntax problem

var getReview = function (movie) {
switch(movie) {
    case "Toy Story 2":
       console.log "Great story. Mean prospector."
    case "Finding Nemo":
        console.log "Great story. Mean prospector."
    case "The Lion King"
    console.log "Great songs."
    default:
     console.log "I don't know!"
}
};

#2

console.log() requires the use of parentheses.


#3

var getReview = function (movie) {
switch(movie) {
case "Toy Story 2":
console.log ("Great story. Mean prospector.")
case "Finding Nemo":
console.log ("Cool animation, and funny turtles.")
case "The Lion King":
console.log ("Great songs.")
default:
console.log ("I don't know!")
}
};


#4

doesnt work still syntax
unexpected identifier


#5

The lion King case is missing a colon


#6

still saying syntax error


#7

nvm did it
var getReview = function (movie) {
switch(movie) {
case "Toy Story 2":
return ("Great story. Mean prospector.")
case "Finding Nemo":
return "Cool animation, and funny turtles."
case "The Lion King":
return ("Great songs.")
default:
return ("I don't know!")
}
};


#8

you didnt use break statement

 case "Toy Story 2":
       console.log ("Great story. Mean prospector.");
       break;
case "Finding Nemo":

need a break statement before next case


#9

You could take a moment to find the syntax problem yourself? instructions:
Write a function named getReview that takes in a movie name and returns its review based on the information above

Use the return keyword. And take a moment to find the syntax problem, you could also find a more verbose editor online :wink:


#10

its ok i found if i used return it said its right but thx anyhow