Evaluate postfix after assignment

# Emanuel Allen (10 years ago)

Typo. I'm worrying about this:

arr[i++]=obj[e]

More so the return =obj[e]

I worry on this:

arr[i++]//this will evaluate first before the value return since the = have a lower
precedence than ++.

So the index that is assign the object will be the index that contains it's string name.

Here reference for precedence: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence

# Bergi (10 years ago)

Emanuel Allen schrieb:

Typo. I'm worrying about this:

arr[i++]=obj[e]

arr[i++]//this will evaluate first before the value return since the = have a lower precedence than ++.

Notice that operator precedence has to do with parsing an (otherwise ambiguous) expression, not with evaulation order.

So this is parsed to

(((arr)[((i)++)])=((obj)[(e)]))

and then basically evaluated left-to-right.

Bergi

# Emanuel Allen (10 years ago)

Oh wow that seem like a lot of work the interpreter is doing...

Thank you for the explanation guys/gals.

Aim to be a JS MASTER.