- From: Darien Maillet Valentine <notifications@github.com>
- Date: Tue, 20 Apr 2021 02:15:13 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 20 April 2021 09:15:30 UTC
JS syntax permits “bare” number tokens without expression-enclosing brackets and bare strings without quotes if they are valid identifiers, but both are effectively shorthand — an ES property key is a string or symbol and any other value gets coerced:
```js
const o = ({ [{ toString: () => '1' }]: 'hello', [2n]: 'world' });
-> {1: "hello", 2: "world"}
[ Reflect.ownKeys(o)[0], typeof Reflect.ownKeys(o)[0] ];
-> [ "1", "string" ]
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/978#issuecomment-823119064
Received on Tuesday, 20 April 2021 09:15:30 UTC