the docs say that the nullish operator (??) is the 5th lowest precedence in operation.
I am trying to use them in this manner
const accountNumber = optionsA?.accountNumber ?? optionB?.accountNo ?? '7202705382';
which I hope to mean
assign accountNumber
in descending order precedence:
optionsA?.accountNumber
optionB?.accountNo
'7202705382'
I am concerned because I want to ensure both that the order is left to right and that the elvis operators in the objects in the first two items do not interfere with the nullish operators valuations or precedence.
Is this the most appropriate way to do this assignment for clarity and terseness in Javascript?
||
, which is adjacent in precedence.