How to make module in NODE JS || How to use module in NODE JS
-
Neel Bhardwaj
-
15-Jan-2022
-
0 comments
-
165
In this, we define module is created in file_1.js and use in file_2.js
for use the one file into another then i use the REQUIRE.
file_1.js
==============================
var sum = function(a,b){
return a+b;
}
module.exports = sum;
file_2.js
==============================
var result = require('./file_1');
console.log(result(1,2));
"Programming isn't about what you know,
it's about what you can figure out.”
Leave a reply
Thanks for comment. Your comment are shown after approve by ADMIN. THANKS!!
There is some server issue. Please try again. THANKS!!
Fatal error: Cannot declare class Connection, because the name is already in use in /home/d8ouyzxnuef4/public_html/thecoderjob.com/cj_admin/classes/Connection.php on line 3
Recent comments