I guess some of this knowledge is helpful or necessary for people who want to know JS inside-out. Nevertheless, none of that code looked like anything a programmer would write if they respected readability and conveyance of code. Maybe I'm just taking things too seriously here...
A code snippet like the following wouldn't make me ask how it works, but it would make me want to find the person responsible for putting this snippet in production code:
var num1 = 5,
num2 = 10,
result = num1+++num2;
(I'm probably thinking in this manner these days because I'm currently in a situation where I'm maintaining someone else's code instead of building something.)
The above example is at least academically interesting since you can reason through it with a bit of programming experience and intuition about operator precedence.
Does plus or pre/postfix increment have higher precedence?
Probably increment.
Does prefix or postfix have higher precedence?
They're probably the same -> evaluate from left-to-right.
Code is equivalent to num1++ + num2;
But the examples like "what is the difference between substring() and substr()", "What is the lowest cross-browser increment that [setInterval()/setTimeout()] can accurately use" is just trivia and is boring.
I don't know. But I happen to know that the javascript tokenizer matches the longest possible substring. Therefore it takes '++' from '+++..', not '+'. It's not about precedence.
EDIT: Yes, the assignment operators, =, += etc., evaluates right to left.
A code snippet like the following wouldn't make me ask how it works, but it would make me want to find the person responsible for putting this snippet in production code:
var num1 = 5, num2 = 10, result = num1+++num2;
(I'm probably thinking in this manner these days because I'm currently in a situation where I'm maintaining someone else's code instead of building something.)