If I have array, for example :
a=["a","b","c"]
I need something like
a.remove("a");
How can I do this?
Answer
var newArray = [];
var a=["a","b","c"];
for(var i=0;i if(a[i]!=="a") newArray.push(a[i]);
EDIT: as of newer versions of JS:
var a = ["a","b","c"];
var newArray = a.filter(e => e !== "a");
No comments:
Post a Comment