Skip to content

Commit

Permalink
Merge pull request #23 from rricard/rb/typeof-placeholder
Browse files Browse the repository at this point in the history
Added section to specify that typeof will return a new value
  • Loading branch information
Robin Ricard committed Jun 11, 2019
2 parents 0f233fc + 4452b0e commit 461672b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -221,6 +221,16 @@ The const array prototype is a const object that contains the same methods as Ar
- `ConstArray.prototype.pop()` and `ConstArray.prototype.shift()` do not return the removed element, they return the result of the change
- `ConstArray.prototype.first()` and `ConstArray.prototype.last()` are added to return the first and last element of the const array
## `typeof`
The typeof operator will return a new value for const objects and const arrays. The value to be returned
is still being considered, and is represented by `<placeholder>` below.
```js
assert(typeof @const { a: 1 } === "<placeholder>");
assert(typeof @const [1, 2] === "<placeholder>");
```
## Usage in {`Map`|`Set`|`WeakMap`}
It is possible to use a const object or const array as a key in a `Map`, and as a value in a `Set`. When using a const object or const array in this way, key/value equality behaves as expected.
Expand Down

0 comments on commit 461672b

Please sign in to comment.