What is wrong in my code? Objects I, ex 4


I have checked my code in both JSHint and JSLint - both report the code as clean, yet I can't get past this exercise?

function getReview() {
"use strict";
var 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.";
return "I don't know!";


function getReview(movie) would be the correct way to write the first part of the code down. Therefore, you do not need to write var movie nor use strict. Also, at the end of every case, you must put a break;

Hope it helped!:smiley:


good call. the variable definition and use strict were both tips from JSLint. Also, does the return string need to be inside parens? ()

// now finished the exercise. thank you ragezapper!


if the return-statement is used in a case
a break is NOT needed, as it is the return-statement which will cause the =exit= from the switch

concerning the named function or anonymous function via a VARIABLE
here an article


Oh.. really? Never knew that :smiley:. Learning everyday, thanks.