arrow function
arrow functions example
by karthick6891
JavaScript
class Prefixer {
constructor(prefix) {
this.prefix = prefix;
}
prefixArray(arr) {
return arr.map((x) => this.prefix + x); // (A)
}
}
var pref = new Prefixer('x');
var pref1 = new Prefixer('y');
console.log(pref.prefixArray([1,2,3]))
console.log(pref1.prefixArray([1,2,3]))