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,567 times
0
RSA
- 1,335
- 4
- 19
- 34
-
4Possible 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
4
You have to set length of an array to zero or use splice.
setting it to [] will create a new array.
user458236
- 171
- 2
- 7