Skip to content

Instantly share code, notes, and snippets.

@jonaskuske
Created December 6, 2018 00:29
Show Gist options
  • Save jonaskuske/9f52dee6db05fbc16ec7bba62ab424e2 to your computer and use it in GitHub Desktop.
Save jonaskuske/9f52dee6db05fbc16ec7bba62ab424e2 to your computer and use it in GitHub Desktop.
Spread happyness
// Copy this into the browser console
let _=i=$D=1;Object.defineProperty(this,'mood',{set(){console.log(`Made ${i++} folks happy!`);Math.random()<.1&&(_=0)}})
// Then you can do this and find out how many people you made happy :)
please: for (;_;) mood = $D
// Copy this into the browser console
let _=i=1;Object.defineProperty(this,'D',{get(){console.log(`${i++} folks smiled!`);Math.random()<.1&&(_=0)}})
// Then you can do this and find out how many people you made smile :)
please: for (;_;) { let smile =D }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment