Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // Unique array
  2. const arr = [1, 1, 2, 3, 4, 4, 5];
  3. const uniqueArr = [...new Set(arr)];
  4.  
  5. // Convert string to number
  6. const str = '22';
  7. const num = +str;
  8. const num2 = ~~str
  9.  
  10. // Convert to boolean
  11. const isTrue = !0;
  12. const isFalse = !1;
  13. const alsoFalse = !!0;
  14.  
  15. // Exponentiation
  16. const n = 8;
  17. const pow = 2 ** n;
  18.  
  19. // Remove all elements from array except n first
  20. const arr = [1, 2, 3, 4, 5];
  21. const n = 2;
  22. arr.length = n;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement