Isn't great, as you've got a copy of the code in the function itself, plus a copy in the instantiated object -> prototypes can be better there too.
Just to add, when minifying, anything that's exposed to the outside world (like stuff in the prototype) can't have its name changed, so uses up more memory.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
If you're writing a module?
Generally I'd say:
Also doing:
Isn't great, as you've got a copy of the code in the function itself, plus a copy in the instantiated object -> prototypes can be better there too.
Just to add, when minifying, anything that's exposed to the outside world (like stuff in the prototype) can't have its name changed, so uses up more memory.