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

Monday, December 3, 2012

Codecademy: Codeyear More practice!


//sample solution

var name = prompt("Enter a name: ");
//Original if else statement
/*if (name === "Nick") {
  truth = true;
} else {
  truth = false;
}*/
//Rewrite the above code using the ternary operator
truth = name === "Nick" ? true: false;

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts