|
1 | 1 | ## ECMA Script 2015 Snippets |
2 | 2 |
|
3 | | -### [je.] parse |
| 3 | +### [je.z.math] Math |
4 | 4 |
|
5 | 5 | ```javascript |
| 6 | +Number.EPSILON |
| 7 | +Number.isInteger(Infinity) // false |
| 8 | +Number.isNaN("NaN") // false |
6 | 9 |
|
| 10 | +Math.acosh(3) // 1.762747174039086 |
| 11 | +Math.hypot(3, 4) // 5 |
| 12 | +Math.imul(Math.pow(2, 32) - 1, Math.pow(2, 32) - 2) // 2 |
| 13 | + |
| 14 | +"abcde".includes("cd") // true |
| 15 | +"abc".repeat(3) // "abcabcabc" |
| 16 | + |
| 17 | +Array.from(document.querySelectorAll('*')) // Returns a real Array |
| 18 | +Array.of(1, 2, 3) // Similar to new Array(...), but without special one-arg behavior |
| 19 | +[0, 0, 0].fill(7, 1) // [0,7,7] |
| 20 | +[1, 2, 3].find(x => x == 3) // 3 |
| 21 | +[1, 2, 3].findIndex(x => x == 2) // 1 |
| 22 | +[1, 2, 3, 4, 5].copyWithin(3, 0) // [1, 2, 3, 1, 2] |
| 23 | +["a", "b", "c"].entries() // iterator [0, "a"], [1,"b"], [2,"c"] |
| 24 | +["a", "b", "c"].keys() // iterator 0, 1, 2 |
| 25 | +["a", "b", "c"].values() // iterator "a", "b", "c" |
| 26 | + |
| 27 | +Object.assign(Point, { origin: new Point(0,0) }) |
7 | 28 | ``` |
0 commit comments