Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

module export javascript

// user.js
exports.getName = () => {
  return 'Jim';
};

exports.getLocation = () => {
  return 'Munich';
};

exports.dob = '12.01.1982';

// index.js
const { getName, dob } = require('./user');
console.log(
  `${getName()} was born on ${dob}.`
);
Source by www.sitepoint.com #
 
PREVIOUS NEXT
Tagged: #module #export #javascript
ADD COMMENT
Topic
Name
1+6 =