Дополнительное задание

        function Box(a, material) { 
            this.height = a;
            this.width = a;
            this.depth = a;
            this.material = material;
            this.volume = function() {
                return "Объем куба = " + a*a*a;
            }
            this.equals = function(obj1, obj2) {
                if (obj1.material === obj2.material) {
                    return console.log("Объекты равные");
                }
                else {
                    return console.log("Объекты не равны")
                }
            }
        }
        var box1 = new Box(100, "steel");
        var box2 = new Box(200, "steel");
        console.log(box1.volume());
        box1.equals(box1, box2); 
                
Назад к списку Перейти к Заданию 1