how to filter through array extracting only numbers in js

Solutions on MaxInterview for how to filter through array extracting only numbers in js by the best coders in the world

showing results for - "how to filter through array extracting only numbers in js"
Maximilian
13 Feb 2018
1//if its an array of objects
2arr.filter((item) => typeof(item.key) === 'number')
3
4//if its an array of values
5arr.filter((item) => typeof(item) === 'number')