Best JS Snippets

A collection of the most useful JavaScript code snippets for efficient and effective programming tasks.

best-js-snippets

20 Best JavScript Snippets.

  1. Get current date and time.
  2. Check if a variable is an array.
  3. Merge two arrays.
  4. Remove duplicates from an array.
  5. Sort an array in ascending order.
  6. Reverse an array.
  7. Convert string to number.
  8. Generate a random number between two values.
  9. Check if a string contains a substring.
  10. Get the length of an object.
  11. Convert object to array.
  12. Check if an object is empty.
  13. Get current URL.
  14. Redirect to a new URL.
  15. Set a cookie.
  16. Get a cookie.
  17. Check if a cookie exists.
  18. Remove a cookie.
  19. Get the current viewport dimensions.
  20. Copy text to clipboard.

Like, Share and Subscribe #DevTools99 for more useful videos, tools info and #tutorials . Thank you!


DevTools99

Developer Co-Team

Let us make it easier for developers throughout the world to breathe. Let's keep things simple. Let's take it easy.