Hey, devs from all over the world. 😊
let x = 0;
x++;
x = x++;
x = ++x;
console.log(x);
What's the value of x
? 🤔🤔
Hey, devs from all over the world. 😊
let x = 0;
x++;
x = x++;
x = ++x;
console.log(x);
What's the value of x
? 🤔🤔
For further actions, you may consider blocking this person and/or reporting abuse
Code Boxx -
Mario Stopfer -
Amelie Lamb -
Programming with Shahan -
Once suspended, bassemibrahim will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, bassemibrahim will be able to comment and publish posts again.
Once unpublished, all posts by bassemibrahim will become hidden and only accessible to themselves.
If bassemibrahim is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Bassem.
They can still re-publish the post if they are not suspended.
Thanks for keeping DEV Community safe. Here is what you can do to flag bassemibrahim:
Unflagging bassemibrahim will restore default visibility to their posts.
Top comments (5)
Placed before a variable, "++" adds one to the variable and the expression with "++" equals the new value of the variable + 1. This can be seen in line 4, where "x = ++x;" really means "x = (x + 1)".
Placed after a variable, however, "++" adds one to the variable and the expression with "++" equals the first value of the variable, without 1 added. This is why line 3, "x = x++;" has no effect — because the "x = x + 1" execution that the "++" gives is executed but then replaced by the the previous value of x.
In the end, you have:
I hope my explanation made sense to you, was a bit hard to explain.
— Gabriel
3?
Dangit. I believe it would be 3 in dart
Well, I am not sure about dart. But we can try it out!!
In javascript its 2 for sure.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.