Skip to content

Instantly share code, notes, and snippets.

@jarmo
Last active November 18, 2020 16:00
Show Gist options
  • Save jarmo/204a2e2f91d103cf9000 to your computer and use it in GitHub Desktop.
Save jarmo/204a2e2f91d103cf9000 to your computer and use it in GitHub Desktop.
var Foo = function() {
this.doStuff = function() {}
}
// kui tahad olla optimaalsem, et oleks ainult üks doStuff funktsioon, siis tuleb protyypida
var Foo = function() {}
Foo.prototype.doStuff = function() {}
// "õige"
var Foo = function() {
function doStuff() { privateDoStuff() + "bar" }
function privateDoStuff() { return "baz" }
return {
doStuff: doStuff
}
}
@Kaonasz
Copy link

Kaonasz commented Nov 18, 2020

Well, it definetly does stuff
:3

@jarmo
Copy link
Author

jarmo commented Nov 18, 2020

It does indeed! Nice find :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment