DEV Community

loading...

Discussion on: PHP 8 features I wish also existed in JavaScript

Collapse
devmount profile image
Andreas Author
  • 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.
Collapse
ogrotten profile image
ogrotten • Edited

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.