jecommera
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.calcCircumfer ence(3);
</script>
</body>
</html>
thanks
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.calcCircumfer
</script>
</body>
</html>
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.