Jump to content

Create a Shape constructor function that has a height and width property. Include a method that will calculate the area of the shape, where area is d


rissa146

Recommended Posts

I am creating a Shape constructor function that has a height and width property. Include a method that will calculate the area of the shape, where area is defined as the shape's height multiplied by its width. Does this look right?



function shapeFunct(x,y){
this.height = x;
this.width = y;
return x * y;
}

// call the function shapeFunct(100,100);
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...