Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Unique array
- const arr = [1, 1, 2, 3, 4, 4, 5];
- const uniqueArr = [...new Set(arr)];
- // Convert string to number
- const str = '22';
- const num = +str;
- const num2 = ~~str
- // Convert to boolean
- const isTrue = !0;
- const isFalse = !1;
- const alsoFalse = !!0;
- // Exponentiation
- const n = 8;
- const pow = 2 ** n;
- // Remove all elements from array except n first
- const arr = [1, 2, 3, 4, 5];
- const n = 2;
- arr.length = n;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement