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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
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')