Skip to content

Commit

Permalink
Part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhansu-kr committed May 1, 2022
1 parent c92fc88 commit 2b97966
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ES6ModuleSystem/02_Part2.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import * as util from './00_Import.mjs';

// Instead of importing each object explicitly, we can just export
// all of the objects using astrix and store it in a obj
console.log(util);f

// this function is also being executed in par3.mjs :?
console.log(util);
console.log(util.adder(3, 54), util.maxi(3, 5));

export const power4 = (num) => {
return num ** 4;
}

// Export different module obj
export * as utility from './00_Import.mjs' ;
15 changes: 15 additions & 0 deletions ES6ModuleSystem/03_Part3.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// To import from two different files, There are various ways

// 1. Multi level Importing - Import obj of base to derive and derive to
// derive2 and so on

import {power4, utility} from './02_Part2.mjs'

console.log(power4(4));

// Error : Util is not exported
// console.log(util.adder(3, 54), util.maxi(3, 5));

// now that utility is imported
console.log(utility.cubic(3)) ;
console.log(utility) ;

0 comments on commit 2b97966

Please sign in to comment.