• 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

Merge two or more arrays together

Merge two or more arrays together

Call concat() on the first array, and pass each array to merge with it in as arguments. It returns a new array.

Miscellaneous

Add items to an array in JavaScript

Add items to an array

Add items to an array. Pass the new items in as arguments.

Miscellaneous

Remove HTML/XML tags from a string

Remove HTML/XML tags from a string

Use a regular expression to remove HTML/XML tags from a string.

Miscellaneous

Convert a string to a number

Convert a string to a number

Sometimes it returns integer. Other times it returns a float. And if you pass in a string with random text in it, you’ll get NaN, an acronym for Not a Number.

Miscellaneous

Check if array has duplicates

Check if array has duplicates

Checks if there are duplicate values in a flat array. Use Set to get the unique values in the array.

Miscellaneous

Make a resizable element

Make a resizable element

First, we need to prepare some elements that indicate the element is resizable. They are placed absolutely at the four sides of the original element.

Miscellaneous

Make a draggable element

Make a draggable element

In order to make an element draggable, we need to handle three events.

Miscellaneous

Template Literals

Template Literals

Template literals provide a simpler way to create strings that span multiple lines or contain data.

Miscellaneous

Looping over an object’s keys and values

Looping over an object’s keys and values

In this example you have access to each pair using the key and value variables during the loop.

Miscellaneous

Determine if a string contains a substring

Determine if a string contains a substring

String.indexOf() returns the index of where the substring starts in the string, or -1 if the substring isn’t found.

Miscellaneous

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 7
  • Go to page 8
  • Go to page 9
  • Go to page 10
  • Go to page 11
  • 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