Friday, 15 August 2014

javascript - "TypeError: undefined is not a function" -


I'm learning JS on codecademy and I'm stuck in the "switch" element section.

The instructions are: "Create your own switch statement in the editor. It can do anything for you! Be sure to include at least three cases and a default."

I always "type error: not an undefined function" I'm sure this is somewhat dumb, but I can not understand it and I tried to search but there was no luck too.

And here is my code:

  // Write down your code! Var console = prompt ("What is your favorite console?"); Switch (console) {case "PS4": console.log ("This is my favorite too!"); break; Case 'Xone': console.log ("Good choice!"); break; Case 'Wii': console.log ("I do not really like it."); break; Default: console.log ("This is not a current common console!"); };  

Redefining.

Used in the console, for example, the print message is the name of the solution to change your problem:

  var console = ...  

On a different name:

  Var likes = ...  

Hope it helps!


No comments:

Post a Comment