I have an array like below and need to filter out the numbers from it ex: [1,2]
var str = [
"https://xx.jpg",
"https://xx.jpg",
"1",
"https://guide.jpg",
"2",
"/static.jpg"
]
I have the below code :
var filtered = str.filter(function(item) {
return (typeof item === "number")
});
but it is not filtering as it is a string.
How to do it?