Here is a javascript trivia problem that gives you something to think about.
Go to your console and run below line.
++[1,2,3][2]
Can you exaplain the output ?
Here is a javascript trivia problem that gives you something to think about.
Go to your console and run below line.
++[1,2,3][2]
Can you exaplain the output ?
For further actions, you may consider blocking this person and/or reporting abuse
Sidwyn Koh -
MFONIDO MARK -
Miro Haapamäki -
Ray -
Once suspended, ks_a4eb6224319 will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, ks_a4eb6224319 will be able to comment and publish posts again.
Once unpublished, all posts by ks_a4eb6224319 will become hidden and only accessible to themselves.
If ks_a4eb6224319 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 KS.
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 ks_a4eb6224319:
Unflagging ks_a4eb6224319 will restore default visibility to their posts.
Top comments (4)
The array selection has a higher operator precedence than the increment by one, so first the item with index
2
from the array is selected, which happens to be 3; this is then incremented by one so you get 4.Yup. That's exactly the case.
If you write as this then it all make sense :
There's a tiny mistake in your adaption:
x++
increments x, but returns the previous value, whereas++x
increments x, but returns the new value.I get 4 and am not sure how to explain the output 🙃