Текст программы на фото. Запускаю, но ничего не происходит. Помогите пожалуйста найти ошибку. Заранее всем спасибо!


У вас в _square лишняя точка около умножения, это должно приводить к ошибке, откройте консоль разработчика в хроме и посмотрите. Плюс методы лучше делать в прототипе, а не ссылками на глобальные функции.
function Rectangle(width, height) {
this.width = width;
this.height = height;
if (typeof this.area != "function") {
Rectangle.prototype.area = function () {
return this.width * this.height;
};
}
if (typeof this.perimeter != "function") {
Rectangle.prototype.perimeter = function () {
return 2 * (this.width + this.height);
};
}
if (typeof this.circumscribedСircle != "function") {
Rectangle.prototype.circumscribedСircle = function () {
return Math.sqrt(this.width * this.width + this.height * this.height);
};
}
}
Как именно запускаете - распишите.
Вот здесь можете попробовать
https://jsfiddle.net/
p.s. Учебник, вероятно, старый. script type = "text/javascript"
всё-таки наполнение объекта prototype должно происходить вне пределов конструктора, поэтому надо так
--------------------------------------------------
function Rectangle(width, height) {
this.width = width;
this.height = height;
}
Rectangle.prototype.area = function () {
return this.width * this.height;
};
Rectangle.prototype.perimeter = function () {
return 2 * (this.width + this.height);
};
Rectangle.prototype.radius = function () {
return Math.sqrt(this.width * this.width + this.height * this.height);
};
------------------------------------------------
Если не против синтаксического сахара, то можно и так
------------------------------------------------
class Rectangle {
constructor(width, height) {
this.width = width;
this.height = height;
}
area() {
return this.width * this.height;
}
perimeter() {
return 2 * (this.width + this.height);
}
radius() {
return Math.sqrt(this.width * this.width + this.height * this.height);
}
}