Created
July 14, 2022 18:51
-
-
Save evgeniyworkbel/869149438ff694f60af7b2092a652a32 to your computer and use it in GitHub Desktop.
Курс: "Введение в ООП" (Хекслет)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Square.js | |
Реализуйте и экспортируйте по умолчанию класс Square для представления квадрата. У квадрата есть только одно свойство — сторона. Реализуйте метод getSide(), возвращающий значение стороны. | |
Пример | |
const square = new Square(10); | |
square.getSide(); // 10 | |
SquaresGenerator.js | |
Реализуйте класс SquaresGenerator со статическим методом generate(), принимающим два параметра: сторону и количество экземпляров квадрата (по умолчанию 5 штук), которые нужно создать. Функция должна вернуть массив из квадратов. Экспортируйте класс по умолчанию. | |
Пример | |
const squares = SquaresGenerator.generate(3, 2); | |
// [new Square(3), new Square(3)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment