About 129,000 results
Open links in new tab
  1. Find length (size) of an array in JavaScript - Stack Overflow

    testvar [1] is the value of that array index, which is the number 2. Numbers don't have a length property, and you're checking for 2.length which is undefined. If you want the length of the …

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

    May 25, 2017 · Array.size () is not a valid method Always use the length property There is a library or script adding the size method to the array prototype since this is not a native array …

  3. What does "array.length -1" mean in JavaScript? - Stack Overflow

    I know how to use the JavaScript for loops to cycle through arrays for example, but I still didn't understand what the array.length -1 means, specifically the -1 part. When using a for loop over …

  4. 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 …

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

    Jan 24, 2016 · When you extend an array by changing its length property, the number of actual elements does not increase; for example, if you set length to 3 when it is currently 2, the array …

  6. How to initialize an array's length in JavaScript?

    Jan 31, 2011 · 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 …

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

    Mar 7, 2012 · There's no length method in built-in javascript objects, but accessing object property is often slower than accessing local variable.

  8. javascript - How does `Array.from ( {length: 5}, (v, i) => i)` work ...

    Array.from () lets you create Arrays from: array-like objects (objects with a length property and indexed elements) and mapFn Optional. Map function to call on every element of the array.

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

    When you set a variable that points to an existing array to point to a new array, all you are doing is breaking the link the variable has to that original array. When you use array.length = 0 (and …

  10. javascript - Array.length gives incorrect length - Stack Overflow

    Jun 26, 2015 · That's because length gives you the next index available in the array. DOCS arrayLength If the only argument passed to the Array constructor is an integer between 0 and …

Refresh