Javascript - delete array items by value LIKE -
this question has answer here:
i have simple array
var array = ['x.89999', 'y.sisisis', 'x.585858']; i want remove items in array starting 'x.' return array:
['y.sisisis'] how can without having loop or iterate entire array? (i know it's not possible don't mind if not possible)
is there builtin / native code can use?
thanks
you may use array.filter()
var newarray = array.filter(function(item){ return item.indexof('x.') !== 1; }); there no way job without looping through whole array. case – array sorted alphabetically. sorting demands looping through too
Comments
Post a Comment