VARIABLES: Mathematical Assignment Operators___Wrong Answer Output?


Hello – I’m new and want to be sure I’m learning this correctly:

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

Question #3 is asking to use the increment operator to increase the value saved to the assay by 1,
but I keep getting the same output for the saved variable; let assay = 3
From my screen shot, please note I’m writing:


Why isn’t the output reading as 4?



let molecule = 16;
let particle = 18;
let assay = 3;

// Add and assign to molecule below
console.log(molecule += 16);

// Multiply and assign to particle below
console.log(particle *= 6.02);

// Increment assay by 1

<do not remove the three backticks above>


variable++ is a postfix operation. I.e. you are printing the value 3 then incrementing it to 4.
You could use a prefix i.e. ++variable, which would increment it first, then print.
You could do a += 1 instead
Or variable = variable + 1

They all work.
The important take away is understanding post and pre fix


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.