I'm facing a challenge that I haven't been able to find a solution to yet. I have an array, let's say var oldArr=['one','two','3'];
, and I need to create a new array containing only the string values. Currently, I'm using the Array.filter
method which works fine. However, someone mentioned that it may not be supported in all browsers. So, I'm wondering how I can filter my array with a solution that works across all browsers.
Here's my current code:
var oldArr=['one','two','3'];
newArr=oldArr.filter(function(a){
return !a.match(/\d/);
});
alert(newArr);
Thank you for your help in advance.