Skip to content

Instantly share code, notes, and snippets.

@ahmarsuhail
Created July 16, 2019 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmarsuhail/f223d236083d1f1a79f78e179f69e8be to your computer and use it in GitHub Desktop.
Save ahmarsuhail/f223d236083d1f1a79f78e179f69e8be to your computer and use it in GitHub Desktop.
const user = {
name: "Ahmar",
keys: [1, 2, 3],
printName: function() {
this.keys.forEach(function(x) {
console.log(this.name);
}, this)
}
}
user.printName(); //Outputs: "Ahmar", "Ahmar", "Ahmar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment