Sololearn: Learn to Code
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 3
When the new Cicle(5, 7) syntax is used, it doesnt know what to do with the arguments. When you try to access height and width properties on the instances created,, it will return undefined, because they are not set. So call the method "pie()" to create new instances. const diagram = new Circle(); diagram.pie(5, 7); const angle = new Circle(); angle.pie(8, 2); const wavy = new Circle(); wavy.pie(1, 3);
24th Jan 2023, 5:55 AM
Liamdev
Liamdev - avatar
+ 3
What is "pie" in your code? You should use the correct syntax to define a constructor: class Circle { constructor(height, width) { this.height = height; this.width = width; } }
24th Jan 2023, 5:51 AM
Tibor Santa
Tibor Santa - avatar