Skip to main content
deleted 2 characters in body
Source Link
rozsazoltan
  • 18.5k
  • 8
  • 50
  • 147

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the [array object][1]array object for browsers that don't implement the filter method, but in the long term it's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a) { return typeof a !== 'undefined'; })); 

It should display [1, 2, 3, 4, 6].

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the [array object][1] for browsers that don't implement the filter method, but in the long term it's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a) { return typeof a !== 'undefined'; })); 

It should display [1, 2, 3, 4, 6].

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the array object for browsers that don't implement the filter method, but in the long term it's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a) { return typeof a !== 'undefined'; })); 

It should display [1, 2, 3, 4, 6].

improved code formatting
Source Link
rozsazoltan
  • 18.5k
  • 8
  • 50
  • 147

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the array object[array object][1] for browsers that don't implement the filter method, but in the long term it's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a) { return typeof a !== 'undefined';  })); 

It should display [1, 2, 3, 4, 6].

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the array object for browsers that don't implement the filter method, but in the long term it's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a){return typeof a !== 'undefined';})); 

It should display [1, 2, 3, 4, 6].

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the [array object][1] for browsers that don't implement the filter method, but in the long term it's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a) { return typeof a !== 'undefined';  })); 

It should display [1, 2, 3, 4, 6].

Active reading. [(its = possessive, it's = "it is" or "it has". See for example <http://www.wikihow.com/Use-Its-and-It%27s>.)]
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the array object for browsers that don't implement the filter method, but in the long term itsit's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a){return typeof a !== 'undefined';})); 

ShouldIt should display [1, 2, 3, 4, 6].

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the array object for browsers that don't implement the filter method but in the long term its easier since all you do is this:

var my_array = [1,2,3,4,5,6]; delete my_array[4]; console.log(my_array.filter(function(a){return typeof a !== 'undefined';})); 

Should display [1, 2, 3, 4, 6]

If you want a new array with the deleted positions removed, you can always delete the specific element and filter out the array. It might need an extension of the array object for browsers that don't implement the filter method, but in the long term it's easier since all you do is this:

var my_array = [1, 2, 3, 4, 5, 6]; delete my_array[4]; console.log(my_array.filter(function(a){return typeof a !== 'undefined';})); 

It should display [1, 2, 3, 4, 6].

added 60 characters in body
Source Link
Loupax
  • 4.9k
  • 7
  • 45
  • 69
Loading
Source Link
Loupax
  • 4.9k
  • 7
  • 45
  • 69
Loading