Linked Questions

62 votes
5 answers
78k views

I'm trying to empty an array containing my drawn coordinates when a button "clear" is pressed. When I call drawnDivs.clear(), I get an error that it is not a function. drawnDivs is certainly an array,...
Nona Urbiz's user avatar
  • 5,041
31 votes
4 answers
52k views

Possible Duplicate: how to empty an array in JavaScript 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.
Ranjith's user avatar
  • 585
11 votes
4 answers
8k views

my script creates an empty array and then fill it. But if new arguments come then script is expected to destroy old one and create new one. var Passengers = new Array(); function FillPassengers(...
ismail atkurt's user avatar
4 votes
3 answers
13k views

Possible Duplicate: how to empty an array in JavaScript var jsonParent = []; This is my jsonArray I am pushing some elements in the array, but now I want to empty this array and remove all ...
user1671219's user avatar
3 votes
2 answers
4k views

I have an array eg: a[3,4,5,6,7,8]. I want to remove all the element in one time and make array as an empty array. How to remove all the element of an array. My code var a = [2,3,4,5,6]; for(var i=...
David's user avatar
  • 4,285
10 votes
2 answers
1k views

Regarding JavaScript, when clearing an array, I've found two methods: myArray.length = 0; vs myArray = new Array() I would guess myArray.length = 0; keeps the reference while myArray = newArray() ...
Aaron's user avatar
  • 3,265
3 votes
4 answers
3k views

Possible Duplicate: how to empty an array in JavaScript Best way to deallocate an array of array in javascript I have an array of objects: var arr = [complexObj1, complexObj2]; If I want to ...
Charlotte Tan's user avatar
4 votes
1 answer
681 views

I'm currently learning arrays in JS. Whats puzzling me is that an array like an object is a reference type. So with that in mind if I create a new reference (variable) to the same array and empty ...
Niall Parker's user avatar
4 votes
2 answers
324 views

If I have to delete all the items in an array, what's the difference between using new Array and length = 0? In the example, apparently the result looks the same. function MyCtrl($scope) { ...
panagulis72's user avatar
  • 2,169
0 votes
1 answer
1k views

I have function, which on change calling method 'saveSelectedValue'. this.$filtercat.on('change', { that : this }, this.saveSelectedValue); This method does only one thing: saving data in array. ...
max's user avatar
  • 108
3 votes
2 answers
336 views

I am using ArrayList as my array, let ArrayList = ['a','b','c','d','e','f']; I am confused in between Method 1 and Method 2 because in both case I Referenced ArrayList by another you can also ...
Manoj Bhardwaj's user avatar
1 vote
3 answers
195 views

So, how would you remove all objects from an array.. My current code is: var array = [""]; function add() { var input = document.getElementById("enterInput")....
Noah's user avatar
  • 63
0 votes
4 answers
259 views

I am trying to reset an array through a function parameter. Here is my code: <script> fruitArray = ["apple", "banana", "orange", "pineapple"] function newFruit(myArray){ myArray=[]; } ...
Steven's user avatar
  • 15
1 vote
1 answer
135 views

im working on a game(snake) with obstacles, when the user get their score to 5 I create more blocks as obstacles: wall = new Array(), wall.push(new Rectangle(30, 50, 10, 10)); is there a clear/empty ...
Pedro 's user avatar
  • 1,450
0 votes
2 answers
70 views

I am having trouble in deleting all elements from an array in mongodb. This is my schema: const userSchema=mongoose.Schema({ name: String, email: String, password: String, blog: [{ ...
Akshat's user avatar
  • 63

15 30 50 per page
1
2 3 4 5
8