(промежуточное значение) .getDate не является функцией
//case 1
const logger = function () {
console.log('hi');
} // missing semicolon here
(function () {})();
//correct
const logger = function () {
console.log('hi');
};
(function () {})();
//case 2
const obj = {
getNum() {
return 5;
},
sum(a) {
// TypeError: (intermediate value).getNum is not a function
return a + super.getNum();
},
};
console.log(obj.sum(10));
//correct
const obj = {
getNum() {
return 5;
},
sum(a) {
// Works (Use this, not super)
return a + this.getNum();
},
};
console.log(obj.sum(10));
Thankful Toucan