frenchie frenchie - 2 years ago 328
Javascript Question

javascript splice

I have an array MyArray and I want to remove one element at position i.

I tried:

MyArray = MyArray.splice(i, 1);


but it's returning the element I want to remove, instead of the array without the element I want to remove.

I''m sure it's a simple fix, thanks anyway.

Answer Source

Change

MyArray = MyArray.splice(i, 1); 

into

MyArray.splice(i, 1); 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download