Quotes help make search much faster. Example: "Practice Makes Perfect"

Monday, December 3, 2012

Codecademy: Codeyear Nested Conditionals: Part 2


//sample solution


var topThree = "false";  //will fail since boolean is expected instead of a string
var winner = "true"; //will fail since boolean is expected instead of a string
var result;

if (topThree === false) {
  result = "Sorry, empty handed";
}
else {
  if (winner === true) {
    result = "Gold!!!";
  } else {
    result = "Not bad! Got a medal!";
  }
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts