Create a constructor function for a 'Cat' object

profileTopsolutions
 (Not rated)
 (Not rated)
Chat

/**
* Create a constructor function for a `Cat` object.
* @constructor
* @param {string} name - The name of the cat as a string
* @param {string} color - The color of the cat
* The above values should be stored and be accessable via the name and color
* properties respectively. In addition, the following methods should be
* callable on a Cat object:
* destroyFurniture({string} name, {number} cost) - adds a piece of destroyed
* furnature
* lastDestroyedFurniture() - returns a object with two key value pairs with
* keys 'name' and 'cost' and values corrisponding to the name and cash money
* value of the last item destroyed.
* totalDestroyed() - returns a {number} that is the total value of destroyed
* furniture.
* nthDestroyed( {number} n ) - Returns the nth destroyed furniture. 0 should
* return the first item destroyed, 1 the second and so on. It should return it
* as an object just as lasatDestroyedFurniture does.
*/

    • 12 years ago
    Complete A++ Solutions
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      basic-javascript-assignment_answer.zip