Create a file named as app. js and export the function using module. exports . module.exports = function (a, b) { console.log(a + b); } Create a file named as index. js and import the file app. js to use the exported function. const sum = require( './app' ); sum(2, 5); Output: 7. Oct 12, 2021