circle = new Circle(); console.log(circle.get_area()); // 3.141592653589793 circle.set_radius(10); console.log(circle.get_area()); // 314.1592653589793 console.log(circle); // the radius of my circle is 10 and it's area is 314.1592653589793
Not sure about the wording of circle.get_area() == 3.14159.. i.e. PI? I mean, surely get_area() means calculate the area not the mathematical constant PI? (maybe it's a trick question)
Not sure about the console.log() method, although i believe it to be some sort of debbuger function.
I need a simple object/class with some properties/methods, namely radius, get_area();
There are quiet a few examples online, but i cant find a simple one that fits my needs or answers my question.
I'm starting with this,
i need to instantiate it and call it within an html documnent. Help appreciated.