Question: Write a complete webpage with embedded JavaScript code to create a shape object and an alligator object. The shape object has following components Properties o

Write a complete webpage with embedded JavaScript code to create a shape object and an alligator object. The shape object has following components Properties o numberOfSides: integer o perimeter: real number (number with decimal places) o area: real number Methods o display): no return, print out current values of all properties of this object with innerHTML o getArea): return the area of this shape object. The alligator object has following components. Properties o name: string. We assume this alligator is raised by human. o weight: real number o color: string . Methods o display0: no return, print out current values of all properties of this object with innerHTML o eat0: no return, print out food list of this alligator Create one shape using the object literal and the other using the new operator. The latter must be made from the Object object. Then call all possible methods from each object created. At the minimum, the HTML code should have a heading and a
element that serves as the anchor for the innerHTML output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
