edition 1 | June 1997 |
edition 2 | June 1998 |
edition 3 | December 1999 |
edition 4 | 👻 |
edition 5 | December 2009 |
edition 6 / ES2015 | June 2015 |
edition 7 / ES2016 | June 2016 |
edition 8 / ES2017 | June 2017 |
…and so on and so on… | June 20xx |
edition 1 | June 1997 |
edition 2 | June 1998 |
edition 3 | December 1999 |
edition 4 | 👻 |
edition 5 | December 2009 |
edition 6 / ES2015 | June 2015 |
edition 7 / ES2016 | June 2016 |
…and so on and so on… | June 20xx |
edition 14 / ES2023 | June 2023! |
get reversed copy of array (equivalent of the in-place array.reverse()
):
array.toReversed() -> Array
get sorted copy of array (equivalent of the in-place array.sort(...)
):
array.toSorted(compareFn) -> Array
get copy of array with item(s) inserted in the middle (equivalent of the in-place array.splice(...)
):
array.toSpliced(start, deleteCount, ...items) -> Array
get copy of array with nth element replaced (equivalent of the in-place array[index] = value
):
array.with(index, value) -> Array
array.find(...)
, but search from the end, looking for the last matching element:
array.findLast(predicateFn) -> ArrayElement
array.findIndex(...)
, but search from the end, looking for the last matching element:
array.findLastIndex(predicateFn) -> ArrayElement
const weakMap = new WeakMap()
// A WeakMap is a Map where the keys are garbage-collectible
const alwaysWorkedAsKey = {}
const didNotWorkAsKey = Symbol('foo')
const valueObject = { /* data data data */ }
weakMap.set(alwaysWorkedAsKey, valueObject) // ✅
weakMap.set(didNotWorkAsKey, valueObject) // ❌
#!/bin/bash
echo Hello world!
#!/usr/bin/env node
console.log("Hello world!")
$ ./script.js
# becomes the same as
$ node script.js