Posts About JavaScript

Object.values and Object.entries in JavaScript

Extract arrays of values or of key-value pairs using the new Object.values and Object.methods available with ES2017 (ES8).

Adding, Removing & Toggling Classes With classList in JavaScript

The classList object makes it easy to add, remove, toggle or check for the presence of classes on elements without having to do string operations.

Introduction to Maps in JavaScript

Maps were introduced with ES6/ES2015, and they are similar to objects. Here's an overview of using maps and the benefits over objects.

Introduction to Sets in JavaScript

Sets allow the creation of collections of unique values. See how they are used in this quick intro.

for...of vs for...in Loops in JavaScript

Forget about traditional for loops, use for...of and/or for...in to iterate over arrays, strings and objects.

Speed Up Scroll Events with Passive Event Listeners

Improve your site's scrolling and touch performance by using passive event listeners for events.

Default Parameters in JavaScript with ES6 / ES2015

See how you can now easily specify default function parameter values in JavaScript.

padStart and padEnd String Methods in JavaScript

padStart and padEnd a two new string methods in JavaScript that make it easy to add character padding to the beginning or end of strings.

Tagged Template Literals With ES6 / ES2015

Tagged template literals allow you to pass a function to be executed on the literal before it gets evaluated.

JSON.parse() and JSON.stringify()

A quick reference for the parse and stringify methods of the JSON object.

Introduction to localStorage and sessionStorage

Learn how to use localStorage and sessionStorage in your web apps.

Lazy Loading Scripts

An easy way to lazily load scripts on certain DOM events. In this example, we load the search script only on the user focus in a search input.

Service Workers: Using SW-Toolbox to Serve an Offline Page

Use Service Workers with SW-Toolbox to not only serve assets from the cache, but also to serve a custom offline page.

A Page Progress Bar with JavaScript and CSS Variables

An easy way to implement a page scroll progress indicator with JavaScript and CSS custom properties.

Object and Array Destructuring in JavaScript with ES6

Destructuring for objects and arrays is a nice new set of syntactic shortcuts that we can now use in our JavaScript code.

ES6 Modules

ES2015 (ES6) gives us native support for modules. Learn their simple syntax here.

A Simple Page Fade-In With JavaScript

Implement a very simple page fade-in effect for your site with some minimal JavaScript and a touch of CSS.

Accessing Elements With querySelector and querySelectorAll

Easily select Elements in Pure JavaScript with querySelector and querySelectorAll.

Pop, Push, Shift and Unshift Array Methods in JavaScript

Four useful methods to add or remove to the end or beginning of arrays in JavaScript.

A Quick Introduction to the Yarn Package Manager

Yarn is a new package manager for JavaScript that aims to be a faster and safer alternative to npm. Learn the basic commands to get you up and running.

Let and Const in JavaScript with ES6 / ES2015

ES6 / ES2015 gives us two new keywords to declare variables: let and const. Learn how to use them and the difference with var.

Introduction to Progressive Web Apps: Service Worker and Web App Manifest

Progressive web apps allow you to create web apps that feel native by allowing access while offline & installing on the home screen. Get a big picture here.

Object Property Value Shorthand in JavaScript with ES6

New with ES6 / ES2015, property shorthands allow you to save time with object definition in JavaScript.

Generator Functions in JavaScript with ES6 / ES2015

New with ES6 / ES2015, generator functions allow to easily define functions that can return multiple values.

Rest Parameters in JavaScript with ES6 / ES2015

New with ES6 / ES2015, rest parameters allow you to more easily work with functions with an arbitrary number of arguments passed-in.

Promises in JavaScript with ES6 / ES2015

Promises allow you to more easily write asynchronous code in JavaScript. Learn their syntax in this quick post.

Using DOMParser to Parse HTML Strings

DOMParser can be used to create a DOM object from an HTML or XML string. See here how it's used.

Template Literals in ES6 / ES2015

Quick post on how to use template literals in the latest version of JavaScript for multiline strings or string interpolation.

console.time() & console.timeEnd() in JavaScript

Use console.time() and console.timeEnd() to see how your code performs.

console.table() in JavaScript

Display data in tables in the console with the table() method.

Arrow Functions in JavaScript

Get familiar with the new JavaScript syntax for arrow functions in ES6.

charCodeAt() String Method in JavaScript

Get the unicode value of a character at a specific position in a string with the charCodeAt method.

charAt() String Method in JavaScript

Get a character at a specific position in a string with the charAt method.

toLowerCase() and toUpperCase String Methods in JavaScript

Convert a string's characters to lower or upper case with toLowerCase() or toUpperCase.

includes() String Method in JavaScript

Check if a string contains another string in just one line of code in JavaScript with the includes method.

Ternary Operator in JavaScript

Simplify the syntax of simple if statements with the ternary operator. Here's how to use it.

reduce() Array Method in JavaScript

Use reduce() on an array in JavaScript to apply a function on the array and reduce it to a single value

JavaScript Reserved Keywords

A list of reserved keywords in JavaScript.

Holmes: Fast Page Searching

Use Holmes for fast content search on a page.

split() String Method in JavaScript

Use split() on a string to split it into an array using a separator of your choice.

concat() Array Method in JavaScript

Use concat() on an array to concatenate with another array.

Share Button: Simple & Stylish Share Button

A simple, compact and beautiful share button for your website.

clipboard.js: Copy Text to the Clipboard

Easily copy text to clipboard in the browser with clipboard.js

Comments in JavaScript

Reference snippet on using comments in JavaScript.

For Loops in JavaScript

A quick snippet with the syntax of for loops in JavaScript.

push() Array Method in JavaScript

Use push() on arrays to add new items to an array.

filter() Array Method in JavaScript

Use filter() on arrays to go through an array and return a new array with the elements that pass the filtering rules.

map() Array Method in JavaScript

Use map() on arrays to return a new array with its items having passed through a function. Here's a quick snippet.

Immediately-invoked function expressions

Protect your code and avoid polluting with immediately-invoked function expressions (IIFE).

✖ Clear

🕵 Search Results

🔎 Searching...