Skip to content

Commit

Permalink
importing variables from other file
Browse files Browse the repository at this point in the history
  • Loading branch information
codingXpert committed Jun 18, 2022
1 parent cdbe436 commit ee0309b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion addition.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
let a = 20;
let b = 30;
console.log("Sum = " , a+b);
console.log("Sum = " , a+b);

module.exports = {
c : 50,
d : 'XYZ'
}
5 changes: 5 additions & 0 deletions import var from other file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const impo= require('./addition');
console.log(impo);
console.log(impo.c);
console.log(impo.d);

0 comments on commit ee0309b

Please sign in to comment.