About 50 results
Open links in new tab
  1. How to initialize an array's length in JavaScript?

    Jan 31, 2011 · 970 Most of the tutorials that I've read on arrays in JavaScript (including w3schools and devguru) suggest that you can initialize an array with a certain length by passing an integer to the …

  2. Find length (size) of an array in JavaScript - Stack Overflow

    Find length (size) of an array in JavaScript Asked 14 years, 11 months ago Modified 2 years, 11 months ago Viewed 348k times

  3. Find Array length in Javascript - Stack Overflow

    Mar 2, 2015 · Using length Property The most straightforward and commonly used method to find the length of an array is by accessing its length property. This property returns the number of elements in …

  4. javascript - Array.size () vs Array.length - Stack Overflow

    May 25, 2017 · The OP was asking 'Array.size () vs Array.length'. From the previous discussions, it was make clear, that the 'size' Function is not part of standard JavaScript but implemented by libraries.

  5. How length property of an array works in javascript?

    Jan 24, 2016 · Adding description from Array#length MDN You can set the length property to truncate an array at any time. When you extend an array by changing its length property, the number of actual …

  6. javascript - How to resize an array - Stack Overflow

    Aug 17, 2015 · Setting the Array.length property is the best answer to this question, clear and performant = elegant. Set default values in the expanded elements with Array.fill () : arr.length = …

  7. Javascript: Is the length method efficient? - Stack Overflow

    37 i'm doing some javascript coding and I was wondering if the length method is "precomputed", or remembered by the JS engine. So, the question is: If I'm checking really often for an array length, …

  8. javascript - Get size of dimensions in array - Stack Overflow

    Apr 20, 2012 · In your case you can simply use arr.length and arr[0].length to find the width and the depth. Often, the arrays will have variable depths which makes it necessary to iterate through the …

  9. How to create an array containing 1...N - Stack Overflow

    We'll use that fact later. Array.apply(null, [undefined, undefined, undefined]) is equivalent to Array(undefined, undefined, undefined), which produces a three-element array and assigns …

  10. javascript - Difference between Array.length = 0 and Array ...

    116 foo = [] creates a new array and assigns a reference to it to a variable. Any other references are unaffected and still point to the original array. foo.length = 0 modifies the array itself. If you access it …