Basic JavaScript: Decrement a Number with JavaScript

INSTRUCTIONS:
myVar should equal 10
myVar = myVar - 1; should be changed
Use the – operator on myVar
Do not change code above the line

ORIGINAL CODE:
var myVar = 11;

// Only change code below this line
myVar = myVar - 1;

MY SOLUTION:

var myVar = 11;

// Only change code below this line
myVar–

RESULTS:
All tests passed except for “myVar = myVar - 1; should be changed.” I did change it. Why isn’t the test passing?

Myvar = Myvar+1 

That’s the same as saying Myvar +=1. Now how could you do that but minus?

Hi, Randell. I was just illustrating the original code and my solution. I didn’t combine them, nor did I add any code above the line.

This is my final solution, and it doesn’t pass the test “myVar = myVar - 1; should be changed.”

var myVar = 11;

// Only change code below this line
myVar–

I had trouble figuring out what you actually were using based on the information you posted.

Your latest posted code would pass if you put a semi-colon after the -- operator. If it does not pass, make sure you are using Chrome and not Edge or Safari.

I forgot the semicolon. Thanks, Randell.