Modules.addCached("Say",`
function hello(name) {
console.log('Hello',name);
}
exports.hello = hello;
`);
are exactly the same code - so it's the same module pattern. It's just easier to write as a function because you don't get the acorn error and you also get syntax highlighting
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.
It's worth noting that:
and
are exactly the same code - so it's the same module pattern. It's just easier to write as a function because you don't get the acorn error and you also get syntax highlighting