JavaScript Subtraction Lesson

Hey everyone,

I am trying to get throught this java script lesson but when i run the test, it says “Only subtract one number from 45.” I don’t get what I am doing incorrectly here. Thanks!

Your code so far


var difference = 45 - 33;
difference=12;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36.

Link to the challenge:

You only need the first line.
var difference = 45 - 33;

That will make difference equal to 12.

Hi @asmakhan :grinning:

Remove second line
difference = 12;

Note - Actually here your second line will override the value of difference , when we declare variable without using var,let and const, it behave like a global variable.

Thank You

Need not to assign value 12 to the variable. Instead just perform the subtraction operation.

var difference = 45 - 33;

So, here difference will be assigned 12.