My Books

Text Processing with JavaScript

Solve complex text validation, extraction, and modification problems efficiently in JavaScript.

Modern Async JavaScript

Delve into async features of JavaScript from ES2020 through ESNext. Start building custom asynchronous iterators and generators, and more for fast, lean code.

JavaScript Brain Teasers

Ready to test your JavaScript skills? Challenge yourself with these brain-teasing puzzles, supercharge your learning journey, and emerge as a JavaScript pro.

Besides the Error constructor, JavaScript provides a set of subclasses that we can use to indicate particular types of errors. These subclasses are SyntaxError, TypeError, URIError, RangeError, ReferenceError, and EvalError. ES2021 adds one more subclass to this list: AggregateError. AggregateError is designed to represent multiple errors in a single object. In situations where multiple errors are possible, like a user input form, it makes sense to group errors. That way you can throw a single error that represents all of the errors instead of one for each invalid input.

In JavaScript, there are several ways to count the occurrences of some text or character in a string. If you need to find the occurrences of a single character, then using the charAt() method inside a loop is the easiest method. Let's look at some examples.

There are dozens of jQuery plugins on the internet to help you create beautiful galleries. Most of them are more aesthetic than functional. This script helps you create a simple and lightweight jQuery photo gallery using unobtrusive JavaScript technique which allows users who have their JavaScript off still use the gallery.

A popular question on forums is how to create random numbers in jQuery. We don't really need to use jQuery for a simple task like this. The Math.random() method in JavaScript can be used to quickly create a random number between 0 and 1

We, as programmers often need to generate random numbers in different application. Generating a random integer in javascript can be done using the Math.random() method. In fact it is one of the several ways that we can use to generate a random number with javascript.

Creating standard-compliant websites is principal aspect of our work. To test if your page is in quirks mode mode you can simply bookmark this JavaScript code on your browser and hit it while viewing the page that you want to find out its rendering mode.