Created
April 30, 2018 20:48
-
-
Save icarcal/dfb8ebc632977ec339794160ae3c5347 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 rick = 'Rick'; | |
var morty = 'Morty'; | |
var earth = 'C31'; | |
function rickAndMorty() { | |
// global context | |
console.log(`These ${this.rick} & ${this.morty} belongs to earth ${this.earth}`); | |
} | |
var earthC39 = { | |
rick: 'Rick', | |
morty: 'Morty', | |
earth: 'C39', | |
rickAndMorty: function rickyAndMorty() { | |
// earthC39 object context | |
console.log(`These ${this.rick} & ${this.morty} belongs to earth ${this.earth}`); | |
} | |
} | |
rickAndMorty(); | |
// These Rick & Morty belongs to earth C31 | |
earthC39.rickAndMorty(); | |
// These Rick & Morty belongs to earth C39 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment