JavaScript Objects The Array Object- filter() - Javascript Objects

What is JavaScript - Array filter() Method?

Javascript array filter() method creates a new array with all elements that pass the test implemented by the provided function.

Syntax

Its syntax is as follows −

Parameter Details

callback − Function to test each element of the array.

thisObject − Object to use as this when executing callback.

Return Value

Returns created array.

Compatibility

This method is a JavaScript extension to the ECMA-262 standard; as such it may not be present in other implementations of the standard. To make it work, you need to add the following code at the top of your script.


Example

Try the following example.

Output

Filtered Value : 12,130,44


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Javascript Objects Topics