Last active
July 17, 2017 09:47
-
-
Save kotAPI/518d8df5635545401ecfe77281e6b64f 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 Company = function(name,worth){ | |
return{ | |
name:name, | |
worth:worth, | |
getNetWorth:function(){ | |
console.log("Name: "+this.name +", Worth :"+this.worth); | |
}, | |
company2:{ | |
name:"Acquired Company", | |
worth:"2Bn", | |
getNetWorth:function(){ | |
console.log("Name: "+this.name +", Worth :"+this.worth); | |
} | |
} | |
} | |
} | |
var newCompany=Company("Hex","4Bn"); | |
newCompany.getNetWorth(); | |
// => Name: Hex, Worth :4Bn | |
newCompany.company2.getNetWorth() | |
// => Name: Acquired Company, Worth :2Bn |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment