diff --git a/solutions/day-03/index.js b/solutions/day-03/index.js new file mode 100644 index 0000000..e6c5588 --- /dev/null +++ b/solutions/day-03/index.js @@ -0,0 +1,12 @@ +// 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) \ No newline at end of file diff --git a/solutions/day-03/math.js b/solutions/day-03/math.js new file mode 100644 index 0000000..6a52f74 --- /dev/null +++ b/solutions/day-03/math.js @@ -0,0 +1,12 @@ +// 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, + } +})() \ No newline at end of file