JavaScript Array pop()

The JavaScript array pop() method is used to remove and return the last element of an array. Syntax: array.pop() Syntax: It will return the last element of an array. Example: <!DOCTYPE html> <html> <head> </head> <body> <script> var a = [“GOLD”,”SILVER”,”DIAMOND”,”RUBY”,”PLATINUM”] document.writeln(a.pop()+”<br>”+”<br>”); document.writeln(a); </script> </body> </html>  

JavaScript Array map()

The JavaScript array map() method is used to call a particular function for each element of the array and returns the new array. Note: The original array will not be changed. It will return a new array. Syntax: array.map (callback(currentvalue,index,arr),thisArg) Parameters: callback: It represents the method to test the condition. It is required. currentValue: It … Read more

JavaScript Array lastIndexOf()

The JavaScript array lastIndexOf() method is used to search the specified element in the given array and returns the index of the last match. Syntax: array.lastIndexOf (element,index) Parameters: element: It is a required parameter and represents the element that has to be searched. index: It is an optional parameter and represents the index position from … Read more

JavaScript Array join()

The JavaScript array join() method is used to join the elements of an array as a string. Syntax: array.join (separator) Parameters: separator: It represents the separator that will be used between array elements and it is an optional parameter. Returns: A string that will contain the array elements with a specified separator. Example: <!DOCTYPE html> … Read more

JavaScript Array indexOf()

The JavaScript array indexOf() method is used to search the specified element in the given array and returns the index of the first match. Syntax: array.indexOf (element,index) Parameters: element: It is required and represents the element that has to be searched. index: It is optional and represents the index position from where the search starts. … Read more

JavaScript Array includes()

The JavaScript array includes() method is used to check whether the given array contains the specified element. Syntax: array.includes (element,start) Parameters: element: It represents the value that has to be searched. It is required. start: It represents the index from where the search starts. It is optional. Returns: Returns true if the given array contains … Read more

JavaScript Array forEach()

The JavaScript array forEach() method is used to invoke the provided function once for each element of an array. Syntax: array.forEach (callback (currentvalue, index, arr), thisArg) Parameters: callback: It represents the method to test the condition. It is required. currentValue: It represents the array’s current element. It is required. index: Current element index. It is … Read more

JavaScript Array findIndex()

The JavaScript array findIndex() method is used to return the index value of the first element in the given array that satisfies the specified condition. Syntax: array.findIndex (callback (value,index,arr), thisArg) Parameters: callback: It represents the method to test the condition. It is required. currentValue: It represents the array’s current element. It is required. index: Current … Read more

JavaScript Array find()

The JavaScript array find() method is used to return the value of the first element in the given array that satisfies the specified condition. Syntax: array.find (callback (value, index, arr), thisArg) Parameters: callback: It represents the method to test the condition. It is required. currentValue: It represents the array’s current element. It is required. index: … Read more

JavaScript Array filter()

The JavaScript array filter() method is used to return the new array containing the elements that pass the provided function conditions. Syntax: array.filter (callback (currentvalue, index, arr), thisArg) Parameters: callback: It represents the method to test the condition. It is required. currentValue: It represents the array’s current element. It is required. index: Current element index. … Read more