const obj = {
name: 'Calculator',
values: [1, 2, 3, 4, 5],
regular: function() {
return this.values.filter(function(x) {
return x > 2;
}).length;
},
arrow: function() {
return this.values.filter(x => x > 2).length;
},
broken: () => {
return this.values.filter(x => x > 2).length;
}
};
console.log(obj.regular());
console.log(obj.arrow());
try {
console.log(obj.broken());
} catch(e) {
console.log('Error');
} Post #2920
3.76K
CHALLENGE
- 👍 6
- ❤ 3
- 🔥 2