1

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.?

RSA
  • 1,417
  • 4
  • 22
  • 37

2 Answers2

6

some times tiny questions are looking so big.
try:

reply = [];
Parsaria
  • 1,049
  • 3
  • 12
  • 18
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