javascript - Plus equal misunderstanding -


i'm trying in browser , don't understand result.

when type :

var testplus = 0; testplus += 2 console.log(testplus) 

it gives testplus = 2.

but when type

var testplus = 0; (testplus +=2) * 2; console.log(testplus) 

it still gives 2, if "*2" weren't calculated. don't why ?

thank

you assigning +2 testplus. *2 happening, answer not being stored anywhere.

so, (testplus +=2) * 2; bumps the value being stored in testplus 2 , multiplied 2, creating value of 4. but, 4 isn't used or stored anywhere.


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -