Last active
November 18, 2020 16:00
-
-
Save jarmo/204a2e2f91d103cf9000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well, it definetly does stuff
:3