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
let array = [0, 1, 2, 3]; | |
array = array.slice(-1); | |
console.log(array); | |
// Result: [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
const array = [1, 1, 2, 3, 6, 6, 7]; | |
console.log( | |
[...new Set(array)] | |
); | |
// Result: [1, 2, 3, 4, 7] |
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
let int = "15"; | |
int = +int; | |
console.log(int); | |
// Result: 15 | |
console.log( | |
typeof int | |
); | |
// Result: number |
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 isTrue = !0; | |
const alsoFalse = !!0; | |
console.log(isTrue); | |
// Result: true | |
console.log(alsoFalse); | |
// Result: 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
const int = 19.8 | 0; | |
console.log(int); | |
// Result: 19 | |
console.log( | |
typeof int | |
) | |
// Result: number |
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 int = 19.8 | 0; | |
console.log(int); | |
// Result: 19 | |
console.log( | |
typeof int | |
) | |
// Result: number |
NewerOlder