Steps to Create a Shape constructor function that has a height and width property

Discussion in 'JavaScript' started by rissa146, Jan 16, 2016.

  1. #1
    Does anyone know the steps to
    Create a Shape constructor function that has a height and width property and Include a method that will calculate the area of the shape, where area is defined as the shape's height multiplied by its width.
     
    rissa146, Jan 16, 2016 IP
  2. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #2
    Isn't that just any function accepting input in javascript?

    myFunction (x,y,unit) {
    return x * y + unit+'^2';
    }

    Takes the two inputs, multiplies them, returns the result + the unit of measure squared (which is the area of the inputs multiplied)
     
    PoPSiCLe, Jan 16, 2016 IP
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,821
    Likes Received:
    4,539
    Best Answers:
    123
    Trophy Points:
    665
    #3
    Homework?
     
    sarahk, Jan 16, 2016 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Yeah, probably - didn't see that OP had posted similar js-questions before I answered this one
     
    PoPSiCLe, Jan 16, 2016 IP
    sarahk likes this.