I'm looking for a way to change the way method "answer(x,y)" behaves in the Child class and swap the variables x and y so that the last statement would return "true". However, the task is that I can't change the Child class, only the Parent.
class Parent {
// some code
}
class Child extends Parent {
answer(x, y) {
this.x = x;
this.y = y;
return 75 - this.x + this.y;
}
}
let v = new Child();
v.answer(5, 15) === 65; //should be true
v.answer(15, 5) === 85; //should be true