Can someone explain why this works:
Object.defineProperty(Array.prototype, 'getRandom', {
value: function(){return this[randomInt(0, this.length)]}
})
But why this doesn't works?
Object.defineProperty(Array.prototype, 'getRandom', {
value: () => this[randomInt(0, this.length)]
})