View Single Post
  #2 (permalink)  
Old May 23rd, 2016, 11:04 AM
irfaan102 irfaan102 is offline
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

He assign the value to the variable "result" first.
Then he increment the variable "myFirstVariable".

If you want to verify, if the variable was incremented just write another alert function under the first one.

<script>
var myFirstVariable=1;
var result;
result=myFirstVariable++;
alert(result);
alert(myFirstVariable);
</script>

If you use the prefix increment:
result=++myFirstVariable;

It will increment first, and then assign the value to the variable.
Reply With Quote