Before I had an idea that inner most groups(regardless of explicit or implicit) in an expression executed first. But as I tested the following code, I've found that I was wrong:
function e(returnValue, name) {
console.log(name);
return returnValue;
}
(1 + (e(1, 'b') + (e(1, 'a') + 1)) + 1);
//Output is:
//b
//a
// Though there is no grouping below explicitly, but there are implicit grouping where the inner most expression is on the right hand side(note that it's short circuit operator and right associative)
false ? e('dog', 'D') :
true ? e('cat', 'C') :
true ? e('monkey', 'M') : e('goat', 'G');
// Output is:
// C
// && has higher precedence so it implicitly groups it's operands and both are short circuit operators
e(false, 'a') || e(false, 'b') && e(true, 'c');
//output is:
//a
//b
Here all the sub expressions are executed left to right, not from highest to lowest precedence. This is what I've found by experimentation. But I'm not absolutely sure that it is true for all cases. I've not found any documentation about this. So in which order JavaScript executes sub expressions of an expression actually? It would be a great help if you also refer to some reliable resource.