JavaScript ES5
ECMAScript 2009 is also known as ES5. It was the first major revision to JavaScript.
ES5 Features
There are various features in ECMAScript 5 or ES5:
String trim()
JavaScript String trim() method
The trim() method removes the white spaces from the beginning and end of the string.
Example1 -
Output -
trimStart() and trimLeft() method
The trimStart() and trimLeft() method will remove the white spaces from the beginning of the strings.
Syntax
var result = string.trimStart();
Example 2 -
Output -
Array foreach()
In this Tutorial you will learn about JavaScript array foreach() method, The foreach() calls a function for each in an array element.
The Syntax of foreach() method is as follows:
arrayName.forEach(function((element) => ( /* ... */ ))
Example 1 -
Output
Example2
Output
Array map()
The map() method creates a new array with the results of calling a provided function on each element in the calling array.
Syntax
var new_array =
current_array.map(function(currentItem, index, array)
{
//Application Logic to current array items
//return items for new array
})
Example1-
Output
Example 2 - Mapping an array of numList to an array of square roots
Output
JavaScript Array Filter
Example1

Output

Example2

Output
