5

Can anyone tell me what the fuck is going on here?

Comments
  • 0
    Empty 2D Array with 1D having five allocations?
  • 0
    @ItsaMeTuni Mine too.
  • 1
    @ItsaMeTuni is spot on. It happens all the time. If you want an exact output of an array at an exact point in time, you can log it as a string.
  • 8
    something like this perhaps?
  • 3
    Read the god damn information bubble!!!!!!
    Gotta teach this like every fucking junior
  • 0
    Skrr. Skrr.
  • 1
    Arrays in JavaScript don't exist, they're just plain object which have the length property, number as keys and the Array prototype.

    You can create arrays also like this:

    function HomeMadeArray() {
    this[0] = 'abc';
    this[1] = 'def';
    this.length = 2;
    }

    HomeMadeArray.prototype = Array.prototype;

    new HomeMadeArray(); // ['abc', 'def']
  • 0
    It's just that the length property is independent of the number of elements but items being added to the array handles the increment/decrement
Add Comment