An object’s key can be anything - even a reserved keyword. And, this may cause unexpected problems in some script engines.
Consider -
|
|
operations
is valid. And, you can go ahead and use the props in any way you wish. We are using node
to execute the script.
|
|
Turns out, nothing really happens even if you try to confuse the engine.
|
|
But the results may not be the same across browsers - especially on older engines. It can lead to runtime syntax errors that are hard to debug and frustrating for everyone.
So -
- never use special words in your keys
- if you must use such keys, enclose them using quotes and use bracket notation to refer to them