• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
JavaScriptSource

JavaScriptSource

Search 5,000+ Free JavaScript Snippets

  • Home
  • Browse Snippets
    • Addon
    • Ajax
    • Buttons
    • Cookies
    • CSS
    • Featured
    • Forms
    • Games
    • Generators
    • Image Effects
    • Math Related
    • Miscellaneous
    • Multimedia
    • Navigation
    • Page Details
    • Passwords
    • Text Effects
    • Time & Date
    • User Details
Home / Archives for Miscellaneous

Miscellaneous

Combine all items in an array into a string

Combine all items in an array into a string

Combine all items in an array into a string, separated by a delimiter that you can pass in as an argument. By default, it will use a comma (,) as the delimiter if one is not provided. Source https://vanillajstoolkit.com/reference/arrays/array-join/

Miscellaneous

Count the occurrences of a value in an array

Count the occurrences of a value in an array

Use Array.prototype.reduce() to increment a counter each time the specific value is encountered inside the array. Source https://www.30secondsofcode.org/js/s/count-occurrences

Miscellaneous

Capture the right click event with JavaScript

Capture the right click event with JavaScript

Two ways to capture the right click on a mouse.

Miscellaneous

Reverse the order of items in an array

Reverse the order of items in an array

Reverse the order of items in an array. Source https://vanillajstoolkit.com/reference/arrays/array-reverse/

Miscellaneous

Return every nth element in an array

Return every nth element in an array

Use Array.prototype.filter() to create a new array that contains every nth element of a given array. Source https://www.30secondsofcode.org/js/s/every-nth

Miscellaneous

Determine whether two values are the same value

Determine whether two values are the same value

The Object.is() method determines whether two values are the same value.

Miscellaneous

Take the content of an array and return a single value

Take the content of an array and return a single value.

Take the content of an array and return a single value. That value can be anything: a string, number, object, or even another array.

Miscellaneous

Remove whitespaces from a string

Remove whitespaces from a string

Returns a string with whitespaces removed. Use String.prototype.replace() with a regular expression to replace all occurrences of whitespace characters with an empty string.

Miscellaneous

Aliases with JavaScript Destructuring

Aliases with JavaScript Destructuring

There are cases where you want the destructured variable to have a different name than the property name.

Miscellaneous

Transform the items in an array and create a new one

Transform the items in an array and create a new one

Iterate through each item in an array, transform it, and return a new array.

Miscellaneous

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 5
  • Go to page 6
  • Go to page 7
  • Go to page 8
  • Go to page 9
  • Interim pages omitted …
  • Go to page 16
  • Go to Next Page »

Primary Sidebar

Popular Posts

Story Generator

IP Grabber – get a users IP address with JavaScript

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2025 JavaScriptSource.com

  • About
  • Privacy Policy
  • FAQ
  • Jobs For Developers