JavaScript code that can be used client-side in the browser and server-side in Node.js
Sample code as follows, read comments for more details 🙂 /** * Example of JavaScript code that can be used client-side in the browser and server-side in Node.js * * Usage in browser: * <script src=”shared.js”></script> * <script> * console.log(shared.STATUS_SUCCESS, shared.test()); // note that shared.getTimestamp() won’t work * </script> * * Usage in Node.js: * …