Skip to content

Instantly share code, notes, and snippets.

@marekpiechut
Last active August 18, 2017 11:37
Show Gist options
  • Select an option

  • Save marekpiechut/52a4039377e1ecf0ec5c6200b177e786 to your computer and use it in GitHub Desktop.

Select an option

Save marekpiechut/52a4039377e1ecf0ec5c6200b177e786 to your computer and use it in GitHub Desktop.
Benchmark - object closure
const createMyType = (startVal) => {
let val = startVal
let magic = ...
return {
add: (b) => {
val += magic + b
},
sub: (b) => { ... },
mul: (b) => { ... },
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment