Nothing to change here - just an explanation.
This code at the bottom of logic.js :
if (typeof module !== 'undefined') {
module.exports = todoFunctions;
}
essentially checks whether it is begin run in frontend or backend. ES5 in the browser does not recognise module / module.exports - in the browser you don't totally need it as you can import scripts from HTML. So without checking if (typeof module !== 'undefined'), referring to module would risk an error.
Nothing to change here - just an explanation. This code at the bottom of logic.js :
essentially checks whether it is begin run in frontend or backend. ES5 in the browser does not recognise
module
/module.exports
- in the browser you don't totally need it as you can import scripts from HTML. So without checkingif (typeof module !== 'undefined')
, referring tomodule
would risk an error.