4 ms·
Ask HN: Anybody knows why do (0, 0, 1) evaluate to 1 in JavaScript?
I understand that in this way:
- Tuples not supported, the last item is returned, for a Python programmer perspective.
- It's a function call. Function name is not given, so the last argument is returned.
- Someone 3y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_operator https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- fatih-erikli 3y agoThanks for the link.
- cranberryturkey 3y agoyes. its doing `(false, false, true)` basically. last argument is true.