i write x++ it produe correct result.but write x=x+1 only it produce wrong result....
– RajkumarMay 26 '22 at 11:24
the increment operator (++) automatically converts the value to a number. I didn't find any detail about it on MDN, but you can see it in ECMAScript specifications: https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-postfix-increment-operator
– GrafiCodeMay 26 '22 at 11:25
this line of pseudo code `2. Let oldValue be ? ToNumeric(? GetValue(lhs)).`, I'm pretty sure `ToNumeric` casts the string value to a number.
– GrafiCodeMay 26 '22 at 11:26
var x=prompt('Enter the number');
var num1 = parseInt(x);
num1+=5;
alert(num1);
– RajkumarMay 26 '22 at 11:58