Last active
March 3, 2019 20:11
-
-
Save BolajiAyodeji/bb8f895b853439b51f987465f8f9762f to your computer and use it in GitHub Desktop.
The This Keyword
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
// method (function inside an object) -> object | |
// function -> global (window, global) | |
const video = { | |
title: 'Bird Box', | |
tags: ['english', 'french', 'chineese'], | |
showTags() { | |
this.tags.forEach(tag => { | |
console.log(this.title, tag); | |
}); | |
} | |
} | |
video.showTags(); | |
// function playVideo () { | |
// console.log(this); | |
// } | |
// playVideo.call({ name: 'Bolaji'}); | |
// playVideo.apply({ name: 'Bolaji'}); | |
// playVideo.bind({ name: 'Bolaji'}) (); | |
// playVideo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment