OK, so I know I got this and the previous exercise correct however I’m confused by something. mainly this line in the hint
a–; // Now, ‘a’ is 4
–a; // Now, ‘a’ is 3
when I changed the variable to both of the challenges (Increments ++i; and decrement --i:) the answer was correct. However, per the hint on this challenge “a–;” and “–a;” gave different values, so shouldn’t the placements of the “–” or “++” with the variable give different values, thus the placement be wrong? the increment test said " myVar should equal 88. I’m not sure if that makes sense, please let me know if I can clarify
Thanks
Johnny
Your code so far
let myVar = 11;
// Only change code below this line
--myVar
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Challenge Information:
Basic JavaScript - Decrement a Number with JavaScript
Using the double minus signs before and after the variable are both valid syntax.
On line one, the variable a is declared and assigned the value 5.
On line two a is decremented using valid syntax so its value is now 4.
On line three a is decremented again using valid syntax so its value is now 3.
right, that rule for the “–i;” worked. For the “++i;” challenge it said that the myVar should = 88. I typed in both “++myVar;” and “myVar++;” and it said that both were correct. since they give different values, how is that question still correct?
Sorry that it’s not making sense. I appreciate your help