1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
  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.