Avatar of jecommera
jecommera
Flag for United Kingdom of Great Britain and Northern Ireland asked on

please help with JS object

Hi,

I am just practising some JS questions.
I need to create a circle object with the Object() constructor and a method that will calculate
its circumference.

Can you please advise what is wrong with my code:

<html>
<head><title>Object object</title>
<script type="text/javascript">

var circle = new Object(radius);
circle.radius = radius;
circle.calcCircumference;

function calcCircumference() {
      return (Math.PI*Math.Pow(radius,2));
}

</script>
</head>
<body bgColor="#EOFFFF">
<script type="text/javascript">
alert(circle.calcCircumference(3);

</script>
</body>
</html>

thanks
JavaScript

Avatar of undefined
Last Comment
Chris Ashcraft

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Chris Ashcraft

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61