Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Helpful example code to demonstrate the use of "this" in JavaScript for my article at
// Example 5. Lost implicit "this" binding #1
function getBaseSpeed(){
console.log("Base Speed Stat is : ", this.baseSpeed);
var pikachu = {
baseSpeed : 90,
getBaseSpeed : getBaseSpeed
var baseSpeedFunction = pikachu.getBaseSpeed;
var baseSpeed = 50;
// Output
// Base Speed Stat is : 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment