Basic JavaScript - Compound Assignment With Augmented Addition = WHY?

Tell us what’s happening:

Would someone please explain to me why are we putting the plus(+) sign behind the equal (=)sign in order to do an addition?? I understand it’s addition that we are trying to do, but what would be wrong if we had put the plus(+) sign forward like we do in human language/world? Ex:

let myVar = 1 myVar = myVar + 5 <!-- or myVar = + 5 , or myVar =+ 5 --> console.log(myVar)

and the value comes out to be 6???

I appreciate that the assignment operator, but I sincerely wish to understand that why we writing/doing addition in a backward way.

Your code so far

let a = 3;
let b = 17;
let c = 12;

// Only change code below this line
a = a + 12;
b = 9 + b;
c = c + 7;

Your browser information:

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

Challenge: Basic JavaScript - Compound Assignment With Augmented Addition

Link to the challenge:

if you will write

a = + b

it means
Hey, JS, I wanna assign +b to the a variable

whatever previous a value was, it won’t play any role in the new assignment

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