Skip to content
Advertisement

How to filter array based on selected objects itself Java script

How to filter an array in Javascript by object value for the below example:

JavaScript

and if I selected the below values

JavaScript

Expected to get this values newArray2= [6,7,8,9];

JavaScript

Advertisement

Answer

It’s built into modern day JavaScript

JavaScript

Assuming your array has only number values

Advertisement