Cannot reproduce MDN's example («Using an object in an array-like fashion») with arrow-function-based method.
> let obj = {
... length: 0,
... addEl: el => [].push.call(this, el={}) //default argument
... };
It counts something, but… what? It definitely stores the incrementing value somewhere, but where?
> obj.addEl();
1
> obj.addEl({});
2
> obj
{ length: 0, addEl: [Function: addEl] } // array function «this» problem?
The original variant increments the length the right way, but it also creates new properties. There was nothing about it in the example.
addEl: function (el) { [].push.call(this, el) }
...
// the function in work
> anotherObj.addEl();
> anotherObj.addEl('new');
> anotherObj
{ '0': undefined,
'1': 'new',
length: 2,
addEl: [Function: addEl] }
Is it ok? If so, I guess, it should be called «creating array-like object», meaning not only the length property, but the numeric keys too. Related, already answered question is here.