Learn JavaScript by Example: Tutorials, Code Snippets & How-To’s

JavaScript Logo

Learn JavaScript in simple and easy steps starting from basic to advanced concepts, with examples including JavaScript tutorials, code snippets, use cases and scenarios.

Vanilla JavaScript or plain JavaScript does not require any third-party libraries or frameworks, and it offers, natively, prototype-based objects, AJAX animations, events, regular expressions, functions as first-class objects, closures, maths libraries, array libraries, string libraries, promises and more.

Also check our JavaScript blog for more resources and tutorials.

Do you need to enable JavaScript in your browser?

Calculating Mean, Median, and Mode in JavaScript

When dealing with statistics, three key measures often come into play — mean, median, and mode. These statistical metrics help us understand data distributions, offering insights into the central tendencies of a…

How to Add Voice Search Capability to Your WordPress Site

How to Add Voice Search to Your WordPress Site Ever wanted to offer voice search functionality on your WordPress site? If you’ve used voice assistants like Siri, Google, or Cortana, you’re familiar…

Animated JavaScript Counter-Up with the Intersection Observer API

An animated counter is a more engaging way to present this information, as it gradually increases the value of the number from zero to its final value. In this tutorial, we will…

How to Build a Vertical Off-Canvas Menu Bar Using JavaScript and CSS

In my work, coming up with fresh navigation ideas and creating an intuitive and efficient navigation system is essential for enhancing user experience. One solution that stands out is the vertical off-canvas…

How to Build a Double Off-Canvas Menu Using JavaScript

Creating a double off-canvas menu can greatly enhance the user experience by providing accessible navigation options without occupying valuable screen space. This article will guide you through how I built a double…

Simplifying Conditional Statements in JavaScript with the && Operator

JavaScript provides several ways to handle conditional logic. One powerful method is the logical AND (&&) operator. This tutorial will show you how to use the && operator and avoid unnecessary if/else…

Grouping Arrays in JavaScript with Object.groupBy() and Map.groupBy()

In JavaScript, there often arises a need to group array elements based on a certain property. Prior to ES2024, this involved custom functions or using libraries like Lodash. However, ES2024 introduced a…

inView

Loading Images Based on Screen Visibility Lazy loading images is a technique that defers the loading of non-critical resources (such as images) until they are needed. This approach can significantly improve page…

Thin Select — Custom JavaScript Dropdown Element

Let’s create a custom <select> element using vanilla JavaScript and CSS. Thin Select provides a sleek and minimalistic design for <select> dropdowns. Here is what we’ll build: See the Pen Thin Select…

How to Create a JavaScript Spinner with Phenakistoscope Effect

In this tutorial, you will learn how to create a JavaScript spinner that mimics the effect of a Phenakistoscope, an early animation device that creates the illusion of motion by spinning images…

All JavaScript Topics

Vanilla JavaScript Repository ⟶

A Repository of Fine JavaScript Libraries and Components

Best free JavaScript & CSS libraries for modern web design.
All scripts and libraries have been created in-house, either as client work or simply as a demo. Feel free to use and improve upon any of them.