What if you want to check for values, that aren't allowed as object key? Also an object would require additional (unnecessary) memory and handling of multiple values with the same assignment isn't very elegant either.
Thank you for this information 👏🏻
That's awesome, I've already read that in other comments.
Named Arguments: pass in an object ;)
Match: This is proposed but is only at Stage-1 and hasn't really progressed over time. See github.com/tc39/proposal-pattern-m...
Optional Chaining: This is already part of ES2020. See bram.us/2017/01/30/javascript-null...
darn near anything is allowable as an object key. Besides that, that's a high corner case.
const x = {
["\$&n"]: 12
}
x["\$&n"]
12
I tried to paste this here in a code block, but it wouldn't show.