How to remove all items from jQuery array?
I have array var myArray = [];
, I want to clear all items in this array on every post back.
Answer
Simplest thing to do is just
myArray = [];
again.
edit — as pointed out in the comments, and in answers to other questions, another "simplest thing" is
myArray.length = 0;
and that has the advantage of retaining the same array object.
No comments:
Post a Comment