Menu
I am trying to learn how to write a custome object. Create a circle with properties and methods. What is wrong with my code? I am getting the first prompt box, but not the alert box showing the diameter. Thanks!
function createObject(){
var radius=prompt(‘Enter the radius:’,””);
var myCircle = new Circle(radius);
myCircle.diamter;
function Circle(radius){
myRadius=radius + 0;
function diameter(){
var diameter=this.myRadius*2;
alert(diameter); }
}
}