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?

All JavaScript Topics ⟢

JavaScript Carousels

A selection of multi-card, JavaScript-powered carousels for modern browsers.

JavaScript Sliders

A selection of JavaScript-powered sliders for modern browsers. Examples included!

JavaScript Time & Date

A collection of time and date related JavaScript examples and how-to’s.

JavaScript Pagination

Various JavaScript pagination techniques, examples, breakdowns, JSON datasets and more.

JavaScript Arrays & Objects

JavaScript array manipulation for various scenarios, such as sorting, mapping, ordering and more.

JavaScript Canvas

A Canvas playground for all kinds of experiments. Drawing, animating, building games.

JavaScript DOM

DOM manipulation, code injection, elements, classes, ID’s, data attributes, nodes, and HTML.

AJAX and Fetching Data

Fetch data, send GET or POST requests, translate JSON responses into parsable data and more.

Methods, Events, and Scopes

this, closures, global and local scopes and other tricky bits.

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.

Thin Select

A custom <select> element with vanilla JavaScript and CSS. Drop your <select> elements inside a <div class="thin-select"></div> element and call it a day.


A responsive, customizable, accessible, zero-dependency, vanilla JavaScript alert/confirm replacement. It automatically centers itself on the page and looks great on any device.


A custom, tiny confirmation modal dialog with Promise support to your website.

A zero-dependency, vanilla JavaScript draggable and horizontally scrollable carousel.


A lightweight, easy to implement and fully responsive vanilla JavaScript Masonry grid. As the screen width changes, the grid automatically adjusts the size and position of the cards to create a seamless and visually appealing layout.


A tiny vanilla JavaScript library that enables drag and drop functionality with zero dependencies. By implementing this library, a user is able to drag and drop elements and reorder them.

A zero-dependency, vanilla JavaScript boxed carousel.


A custom replacement for your HTML <select> fields with nothing but vanilla JavaScript!

Minimal Slider

A minimal responsive JavaScript slider with CSS transitions, autoplay, infinite slides and wrap-around functionality.


A tiny, tiny vanilla JavaScript lazy loading script that loads images based on screen visibility. Did I say tiny?

Price Range Slider

All JavaScript range sliders are hacks or workarounds. Because there’s no native HTML element for a range slider (only a single value slider), there are lots of libraries and solutions out there.

Mine is the simplest 🀨 and the most fit for my purpose. Feel free to borrow it and improve upon it.

Thin UI

Thin UI is an opinionated, lightweight UI framework consisting of a Flex-powered column grid and a list of basic components, such as form fields and buttons. Built using a functional CSS approach, which means you get exactly what you ask for, without any hidden surprises. The resulting file size is far smaller than a traditional CSS framework.

Thin Table Pagination

This is a JavaScript script that adds pagination functionality to HTML tables. Specifically, the script allows users to display only a certain number of rows per page – by dividing the table rows into pages – and navigate between pages using a set of page navigation links.

Enlageable Images

This script creates a fake lightbox effect to any image, allowing it to become enlargeable on click. It’s a good alternative to any lightbox plugin, or when an <a> element is not desirable.