Javascript: Circle

JS: Introduction to Object Oriented Programming (OOP)
Last update: 14 Jan 23:20
0
Students

Circle.js

Implement and export as default the Circle class. A circle has only one property, a radius. Implement the getArea() and getCircumference() methods, which calculate and return the area and circumference.

Examples

const circle = new Circle(3);
circle.getArea(); // 28.274...

Tips

  • Circle area: πr2
  • Circumference: 2*πR

For full access to the challenge you need a professional subscription.

A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests