This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var e = new Error(); | |
e.name = ‘MyError’; | |
throw e; | |
// is equivalent to: | |
class MyError extends Error {} | |
throw MyError(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> (7).toString().padStart(3, '0'); | |
"007" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> f'{7:03}' | |
'007' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> const sort = require('immutable-sort') | |
>>> var a = [3, 2, 1]; | |
>>> var b = sort(a); | |
>>> b | |
[1, 2, 3] | |
>>> a | |
[3, 2, 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> var a = [3, 2, 1]; | |
>>> var b = a.sort(); | |
>>> b | |
[1, 2, 3] | |
>>> a | |
[1, 2, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> a = [3, 2, 1] | |
>>> sorted(a) | |
[1, 2, 3] | |
>>> a | |
[3, 2, 1] | |
>>> a.sort() | |
>>> a | |
[1, 2, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = {'a': 1, 'b': 2} | |
y = {'b': 2, 'a': 1} | |
_.isEqual(x, y) // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = {'a': 1, 'b': 2} | |
y = {'b': 2, 'a': 1} | |
x === y // false | |
x == y // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HashMap<String, Object> map1 = new HashMap<String, Object>(); | |
map1.put("a", 1); | |
map1.put("b", 2); | |
TreeMap<String, Object> map2 = new TreeMap<String, Object>(); | |
map2.put("b", 2) | |
map2.put("a", 1); | |
map1.equals(map2); // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> x = {'a': 1, 'b': 2} | |
>>> y = {'b': 2, 'a': 1} | |
>>> x == y | |
True |
NewerOlder