• 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

Remove an item from an object

Remove an item from an object

Use the delete operator on the key to remove. Source https://vanillajstoolkit.com/reference/objects/delete/

Miscellaneous

Return an array of elements that appear in both arrays

Return an array of elements that appear in both arrays

Use Array.prototype.includes() to determine values that are not part of values. Use Array.prototype.filter() to remove them. Source https://www.30secondsofcode.org/js/s/similarity

Miscellaneous

Check if a string is a valid JSON

Check if a string is a valid JSON

Source https://github.com/roeib/JavaScript-snippets#check-if-a-string-is-a-valid-json

Miscellaneous

Perform a shallow merge of two or more objects

Perform a shallow merge of two or more objects

Perform a shallow merge of two or more objects into the first. Pass in each object to merge as an argument. Note: in a shallow merge, nested objects are overwritten completely rather than having their values merged together. All objects are merged into the first. To create a new object, pass in an empty object as […]

Miscellaneous

Convert a string to an array of characters

Convert a string to an array of characters

Use the spread operator (…) to convert the string into an array of characters. Source https://www.30secondsofcode.org/js/s/to-char-array

Miscellaneous

Vanilla JS toggle

Vanilla JS toggle

Source https://github.com/roeib/JavaScript-snippets#vanilla-js-toggle

Miscellaneous

Get an array of key/value pairs from an object

Get an array of key/value pairs from an object

Return an array of key/value pairs, also represented as arrays. Pass in the object as an argument. Source https://vanillajstoolkit.com/reference/objects/object-entries/

Miscellaneous

What is the difference between prefix and postfix operators?

What is the difference between prefix and postfix operators?

The increment operator (++) adds 1 to its operand and returns a value. Similarly, the decrement operator (–) subtracts 1 from its operand and returns a value. Both of these operators can be used either prefix (++i, –i) or postfix (i++, i–). If used prefix, the value is incremented/decremented, and the value of the expression is the updated value. If used […]

Miscellaneous

Fire an event listener only once

Fire an event listener only once

Source https://github.com/roeib/JavaScript-snippets#fire-an-event-listener-only-once

Miscellaneous

Return an array of keys from an object

Return an array of keys from an object

Return an array of keys from an object. Pass in the object as an argument. Source https://vanillajstoolkit.com/reference/objects/object-keys/

Miscellaneous

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 11
  • Go to Next Page »

Primary Sidebar

FREE UPDATES!

Get the latest updates in your inbox for FREE!

Popular Posts

Story Generator

IP Grabber

Simple Calendar

Remove Ads

Astrological Calculator

Copyright © 2022 JavaScriptSource.com

  • About
  • Privacy Policy
  • Submit
  • FAQ
  • Jobs For Developers
  • Contact Us