5. Adding to an existing switch (console.log is not a function?)


var color = prompt("What's your favorite primary color?","Type your favorite color here");

switch(color) {
  case 'red':
    console.log("Red's a good color!");
  case 'blue':
    console.log("That's my favorite color, too!");
  //Add your case here!
   case 'yellow':
    console.log("thats cool");
    console.log("I don't think that's a primary color!");

it says: TypeError: console.log is not a function.

what am I doing wrong?


TypeError: console.log is not a function.

This often happens when console.log = (value) is used instead of console.log(value). In this case console.log gets overwritten with the value instead of displaying it. The solution here is to just refresh the page to reload the javaScript and thereby resetting console.log to its original value.


You also need to add a break underneath the default.


Default is the last case so you'll stop there anyway :wink: