Back to tasksGet help with live coding in real time with Sobes Copilot
Junior — Middle+
34
Поведение this в обычной функции и стрелочной функции
Task condition
Что будет возвращено при вызове следующих методов?
function getDiameter() {
return this.radius * 2;
}
const figure = {
radius: 10,
diameter: getDiameter,
perimeter: () => 2 * Math.PI * this.radius,
};
figure.diameter(); // ?
figure.perimeter(); // ?