Created
March 26, 2022 18:22
-
-
Save rehasantiago/7e464e05faf7405d7bbb63aa9ca1ce67 to your computer and use it in GitHub Desktop.
Revealing the mystery behind this - https://readosapien.com/revealing-the-mystery-behind-this
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
let song1 = { | |
song: 'Blank Space', | |
getSong: function() { | |
console.log(this.song); | |
} | |
}; | |
let song2 = { | |
song: 'Levitating', | |
}; | |
let song3 = { | |
song: 'Uptown Funk' | |
} | |
let song = song1.getSong.bind(song2); | |
song(); // Levitating | |
console.log(song.call(song3)); // Levitating | |
console.log(song.apply(song3)); // Levitating | |
console.log(song.bind(song3)()); // Levitating |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment