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
function someFunction(){ | |
console.log("I am a :" + this.thing); | |
console.log(this.somethingElse); | |
} | |
var object = { | |
thing : "programmer", | |
somethingElse:"somethingElse" | |
} |
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", |
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 |
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 myObject = { | |
name: "Matt Murdock", | |
age: 28, | |
callFunction:function(){ | |
console.log("My name is "+ this.name + " and I’m " +this.age+ " years old." | |
} | |
} | |
myObject.callFunction(); | |
//=> My name is Matt Murdock and I'm 28 years old. |
NewerOlder