Reputation: 84
When I evaluate one specific variable in Chrome DevTools - Console, this is the result:
(3) [Array(2), Array(2), Array(2), push: ƒ]
I know the f means, the array contains a function.
What does the word push stand for in this context?
Upvotes: 1
Views: 127
Reputation: 4097
It means that someone has added a custom property to the array. It's not the standard Array.prototype.push
, it's something else.
const arr = [1, 2];
arr.push = () => 'some custom implementation';
console.log(arr);
If the standard .push
was there, it wouldn't be showing up in the console.
(Try to avoid this in professional code. It's weird.)
Upvotes: 4