Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. function killSomeone(person) {
  2. person.alive = false;
  3. console.log(person.fullName + " is killed.");
  4.  
  5. // The magical line to catch the bad guy red handed!
  6. console.log(this);
  7. }
  8.  
  9. var good_guy = {
  10. fullName: "The Good Guy",
  11. alive: true
  12. };
  13.  
  14. var bad_guy = {
  15. fullName: "The Bad Guy",
  16. alive: true
  17. };
  18.  
  19. // bad guy learns about killSomeone and borrows it.
  20. bad_guy.killForFun = killSomeone;
  21.  
  22. bad_guy.killForFun(good_guy);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement