Link to home
Create AccountLog in
Avatar of jecommera
jecommeraFlag 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
ASKER CERTIFIED SOLUTION
Avatar of Chris Ashcraft
Chris Ashcraft
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account