Computer Science, asked by Manvi1105, 1 year ago

Students of Web Technology of class 11
Plz solve this problem of JavaScript regarding Increment Operator :

x=5;
y = x + (x++) + (x++)

Please inform me where the value gets changed... Plz help me out.....

Answers

Answered by Atulkrishnan
1
I think the value stored in y is 16 as the increment used here is postfix right.So whenever it is called,it uses the existing value but increases the value for next use....So I think it is 16.
If the increment was prefix,then the answer would have been 18...
Well I am not a student of Web Technology.....I belong to CS with C++....
But since javascript is an object oriented scripting language.....the increment which we studied is same for you guyz too 

Atulkrishnan: PLZ RATE IT...
Manvi1105: Thank... It help me a lot.. I knew the answer still I wanted to know about the change in value of x.. Thanks again
Atulkrishnan: Anytime...
Similar questions