SHARE
TWEET

Untitled

a guest Apr 20th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top