The JavaScript language features roundup
The JavaScript language specification, also known as ECMAScript or ES, is a living document, modified every year in response to evolving needs. While JavaScript started as a scripting language, the ECMAScript specification overview notes that the language “is now used for the full spectrum of programming tasks in many different environments and scales." Because of this, JavaScript is better understood as a fully featured general-purpose programming language.With the upcoming ECMAScript 2022 release just around the corner, let's take a look at the new JavaScript language features introduced in ECMAScript 2021. [ Also on InfoWorld: Builder CEO: Where JavaScript is headed is super interesting ] String.prototype.replaceAll The replaceAll() method takes a string or regular expression, called the pattern, as its first argument. The second argument is the pattern's replacement. Given the first and second argument, replaceAll() returns a new string that will be the source string with all instances of the pattern swapped for the replacement. The source string is not affected.To read this article in full, please click here
The JavaScript language specification, also known as ECMAScript or ES, is a living document, modified every year in response to evolving needs. While JavaScript started as a scripting language, the ECMAScript specification overview notes that the language “is now used for the full spectrum of programming tasks in many different environments and scales." Because of this, JavaScript is better understood as a fully featured general-purpose programming language.
With the upcoming ECMAScript 2022 release just around the corner, let's take a look at the new JavaScript language features introduced in ECMAScript 2021.
String.prototype.replaceAll
The replaceAll()
method takes a string or regular expression, called the pattern, as its first argument. The second argument is the pattern's replacement. Given the first and second argument, replaceAll()
returns a new string that will be the source string with all instances of the pattern swapped for the replacement. The source string is not affected.