Я новичок в JS и не очень знаком со старой версией, у меня есть этот тест, который мне нужно конвертировать в Es6. Кто-нибудь может помочь мне понять, как я могу это сделать?
'use strict';
function Shape(id, x, y) {
this.id = id;
this.setLocation(x, y);
}
Shape.prototype.setLocation = function(x, y) {
this.x = x;
this.y = y;
};
Shape.prototype.getLocation = function() {
return {
x: this.x,
y: this.y
};
};
Shape.prototype.toString = function() {
return 'Shape(' + this.id + ')';
};
function Circle(id, x, y, radius) {
Shape.call(this, id, x, y);
this.radius = radius;
}
Circle.prototype = Object.create(Shape.prototype);
Circle.prototype.constructor = Circle;
Circle.prototype.toString = function() {
return 'Circle > ' + Shape.prototype.toString.call(this);
};