Closed krinsman closed 6 years ago
The behaviour of items++
is defined by the JS standard. It'll make more sense to you, when you compare it to the behaviour of ++items
. See MDN's documentation.
@n-riesco Thanks for the clarification! It is appreciated, especially by a Javascript newbie like me.
I'm not sure if this is just a question or an actual issue, since I'm not sure what the intended behavior is. Anyway I just found this a little odd; it's obviously not important though since (I'm guessing) in Javascript
++
and--
aren't commonly used operators. Anyway,if one does
one gets
Out[1]: 11
.But if one does instead:
one gets
Out[1]: 10
.Entirely analogously, if one does
one gets
Out[1]: 4
.But if one does instead:
one gets
Out[1]: 5
.This might make sense. If it does make sense, then I don't know why it makes sense, since I had naively expected them to give the same output.
Just to clarify, if one does
one gets
Out[1]: 4
, and likewise if one doesone gets
Out[1]: 11
. I.e. the interpreter or whatever else is working correctly.In yet other words, this seems to be solely an issue of display/presentation. I'm not sure if
ijavascript
itself is responsible for the "P" part in REPL, so even if this is an unintended quirk, it's not clear to me if this is where this should be mentioned.