• 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

Copy a segment of an array into a new array

Copy a segment of an array into a new array

The first argument is the array index to start at, and the second is the index to end on.

Miscellaneous

Check if the given string is an absolute URL

Check if the given string is an absolute URL

Use RegExp.prototype.test() to test if the string is an absolute URL.

Miscellaneous

Find the difference between two arrays with JavaScript

Find the difference between two arrays

Compare two arrays and display the difference between the two.

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

Generate a random hexadecimal color code

Generate a random hexadecimal color code

Use Math.random() to generate a random 24-bit (6 * 4bits) hexadecimal number.

Generators

Generate a random number in a given range with JavaScript

Generate a random number in a given range

The following snippet returns a random number between min (inclusive) and max (exclusive).

Math Related

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

Smooth Scroll to the Top of the Page With JavaScript

Smooth Scroll to the Top of the Page With JavaScript

Get distance from top using Document.documentElement or Document.body and Element.scrollTop.

Navigation

Get the largest number from a set of numbers

Get the largest number from a set of numbers

Math.max() returns the largest number from a set of numbers. Pass each number in as an argument.

Math Related

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

  • « Go to Previous Page
  • Go to page 1
  • Interim pages omitted …
  • Go to page 10
  • Go to page 11
  • Go to page 12
  • Go to page 13
  • Go to page 14
  • Interim pages omitted …
  • Go to page 36
  • 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