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.

The ninth edition of the ECMAScript standard, officially known as ECMAScript 2018 (or ES2018 for short), was released in June 2018. Starting with ES2016, new versions of ECMAScript specifications are released yearly rather than every several years and add fewer features than major editions used to. The newest edition of the standard continues the yearly release cycle by adding four new RegExp features, rest/spread properties, asynchronous iteration, and Promise.prototype.finally. Let's have a good look at each of these new features.

ECMAScript 6 (or ECMAScript 2015) has remarkably improved parameter handling in JavaScript. We can now use rest parameters, default values and destructuring, among other new features. In this tutorial, we will explore arguments and parameters in detail and see how ECMAScript 6 has upgraded them.

Having a good understanding of constructors is crucial to truly understand the JavaScript language. Technically, JavaScript doesn't have classes, but it has constructors and prototypes to bring similar functionality to JavaScript. In fact, the class declaration introduced in ES2015 simply works as syntactic sugar over the existing prototype-based inheritance and does not really add any extra functionality to the language.

This article explores different options for preserving paragraph formatting in PHP. It will show you how to display entered text in a textarea properly without the need to use the PHP nl2br function.

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.

Alternate row colors (or zebra striping) is a great way to make long lists and tables easier to read. This technique is especially useful for large tables. In PHP, we can easily change the color of every other row of this table by using a ternary operator inside a while loop.

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 are used to arranging our time by the days of the week. People usually use phrases like “next Friday” or “last sunday.” It's easier for us to understand rather than reading a date and having to work out that it means next Friday. In this post, we'll look at how to calculate the day of the week of a given date such as "Apr 25th 1990" in PHP.