Since its introduction in ECMAScript 2015, the Promise object has provided two methods for tracking the state of asynchronous tasks: Promise.all() and Promise.race(). Although these methods have opened new possibilities in JavaScript, there are still use cases that aren’t covered. To fill this gap, two additional methods are proposed to be added to the specification: Promise.allSettled() and Promise.any(). In this post, we’ll take a good look at new and existing promise methods (also known as promise combinators) and see how they differ.

In JavaScript, the Number type cannot safely represent integer values larger than 9007199254740991. This limitation has forced developers to use inefficient workarounds and third-party libraries. BigInt is a new data type that can represent integer values larger than the range supported by the Number type. The ability to represent integers with arbitrary precision is particularly important when performing mathematical operations on large integers. With BigInt, integer overflow will no longer be an issue. Additionally, you can safely work with high-resolution timestamps, large integer IDs, and more without having to use a workaround.

The most common way for frontend programs to communicate with servers is through the HTTP protocol. You are probably familiar with the Fetch API and the XMLHttpRequest interface, which allow you fetch resources and make HTTP requests. If you are using a JavaScript library, chances are it comes with a client HTTP API. jQuery’s $.ajax() function, for example, has been particularly popular with frontend developers. But as developers move away from such libraries in favor of native APIs, dedicated HTTP clients have emerged to fill the gap.

ECMAScript 2019 (or ES2019 for short) introduces exciting new features such as Object.fromEntries(), flat(), flatMap(), trimStart(), trimEnd(), description property for symbol objects, optional catch binding, and more. The good news is that these features have already been implemented in the latest versions of Firefox and Chrome, and they can also be transpiled so that older browsers are able to process them. In this post, we will take a good look at these features and see how they upgrade the language.

It’s common for a webpage to use data and widgets from external sources. With no encapsulation, styles may affect unwanted parts of the HTML, forcing developers to use excessively specific selectors and !important rules to avoid style conflicts. Still, these efforts don’t seem to be very effective when writing large programs, and a significant portion of development time is wasted on preventing CSS and JavaScript collisions. The Shadow DOM API aims to solve these and other problems by providing a mechanism to encapsulate DOM trees.

There’s a good reason the majority of programming languages support regular expressions: they are extremely powerful tools for manipulating text. If you have ever done any sort of sophisticated text processing and manipulation in JavaScript, you’ll appreciate the new features introduced in ES2018. In this article, we take a good look at how the ninth edition of the standard improves the text processing capability of JavaScript.

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.