Created
July 17, 2017 08:33
-
-
Save kotAPI/00b79dcee307ad15c7e32a2fdaaa1816 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var InventoryDetails = function(obj){ | |
obj.GetInventoryDetails = function(){ | |
console.log("You are "+this.name+ " and you have "+ this.pencils + " pencils and "+ this.pens+ " pens."); | |
} | |
} | |
var JackInventory = { | |
name:"Jack", | |
pencils:264, | |
pens:23 | |
} | |
var DonInventory = { | |
name:"Don", | |
pencils:361, | |
pens:68 | |
} | |
InventoryDetails(JackInventory); | |
InventoryDetails(DonInventory) | |
JackInventory.GetInventoryDetails(); | |
DonInventory.GetInventoryDetails(); | |
// => You are Jack and you have 264 pencils and 23 pens. | |
// => You are Don and you have 361 pencils and 68 pens. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment