parent
f297f0cf15
commit
f7e481895a
@ -1,12 +0,0 @@
|
|||||||
// index.js
|
|
||||||
// to import the doSomeMath from the math.js with or without extension
|
|
||||||
import doSomeMath from './math.js'
|
|
||||||
|
|
||||||
// to import the other modules
|
|
||||||
// since these modules were not exported as default we have to desctructure
|
|
||||||
import { addTwo, multiply, subtract } from './math.js'
|
|
||||||
|
|
||||||
import * as everything from './math.js' // to import everything remaining
|
|
||||||
console.log(addTwo(5, 5))
|
|
||||||
console.log(doSomeMath.addTwo(5, 5))
|
|
||||||
console.log(everything)
|
|
@ -1,12 +0,0 @@
|
|||||||
// math.js
|
|
||||||
export const addTwo = (a, b) => a + b
|
|
||||||
export const multiply = (a, b) => a * b
|
|
||||||
export const subtract = (a, b) => a - b
|
|
||||||
|
|
||||||
export default (function doSomeMath() {
|
|
||||||
return {
|
|
||||||
addTwo,
|
|
||||||
multiply,
|
|
||||||
subtract,
|
|
||||||
}
|
|
||||||
})()
|
|
Loading…
Reference in new issue