I get it, I can’t use arrows when it comes to constructor function.
But the thing is: in challenge steps of OOP section,in general, there are no single example with arrow functions in instructions, though I was able to pass many tests using arrow functions. Couple of examples:
Like here (IIFE), I wrote it with arrows:
And creating mixins:
Example for mixins from instruction:
let flyMixin = function(obj) {
obj.fly = function() {
console.log("Flying, wooosh!");
}
};
My solution:
let bird = {
name: "Donald",
numLegs: 2
};
let boat = {
name: "Warrior",
type: "race-boat"
};
// Only change code below this line
let glideMixin = (obj) => {
obj.glide = () => "Outstanding gliding is happening!"
}
glideMixin(bird);
glideMixin(boat);
I am curios: is there any reason not to use arrow func-s when it comes to object-related code?