Closed JakeChampion closed 6 years ago
That recommendation is not yet merged.
(Separately, polyfills included in proposal repos are not intended for production use, and are solely intended to be explanatory - as such, it’s not really important that the code be robust)
In reality the polyfill is overkill anyway, you probably just want:
Object.defineProperty(Array.prototype, 'end', {
get() {
return this[this.length-1];
},
set(value) {
return this[this.length ? this.length-1 : 0] = value;
}
});
I would have expected the polyfill to make use of semi-colons because the TC39 recommend the use of semi-colons.