In project I define an empty array var reply= [];
and in a portion of code and conditions I had o reset it to its origin as an empty array. any one can help how to do this instead of using pop method.?
Asked
Active
Viewed 2,809 times
1

RSA
- 1,417
- 4
- 22
- 37
-
5Possible duplicate of [How do I empty an array in JavaScript?](https://stackoverflow.com/questions/1232040/how-do-i-empty-an-array-in-javascript) – JJJ Jun 29 '17 at 15:59
-
`reply = []`? or what are you looking for? – scrappedcola Jun 29 '17 at 16:00
-
Thanks. reply = [] was great. – RSA Jun 29 '17 at 19:34
2 Answers
6
You have to set length of an array to zero or use splice.
reply.length = 0
// or
reply.splice(0, reply.length)
setting it to [] will create a new array.

Matt
- 68,711
- 7
- 155
- 158

user458236
- 191
- 3
- 7