diff --git a/chapter-02/07-es6-modules/01-es6-modules.html b/chapter-02/07-es6-modules/01-es6-modules.html new file mode 100644 index 00000000..1a939d58 --- /dev/null +++ b/chapter-02/07-es6-modules/01-es6-modules.html @@ -0,0 +1,24 @@ + + +
+ + +Open the console
+ + + diff --git a/chapter-02/07-es6-modules/02-es6-modules-import-alias.html b/chapter-02/07-es6-modules/02-es6-modules-import-alias.html new file mode 100644 index 00000000..750883ce --- /dev/null +++ b/chapter-02/07-es6-modules/02-es6-modules-import-alias.html @@ -0,0 +1,21 @@ + + + + + +Open the console
+ + + diff --git a/chapter-02/07-es6-modules/mt-freel.js b/chapter-02/07-es6-modules/mt-freel.js new file mode 100644 index 00000000..8512336a --- /dev/null +++ b/chapter-02/07-es6-modules/mt-freel.js @@ -0,0 +1,26 @@ + +class Vacation { + constructor(destination, length) { + this.destination = destination + this.length = length + } + + print() { + console.log(`${this.destination} will take ${this.length} days.`) + } + +} + +class Expedition extends Vacation { + constructor(destination, length, gear) { + super(destination, length) + this.gear = gear + } + + print() { + super.print() + console.log(`bring your ${this.gear.join(" and your ")}`) + } +} + +export default new Expedition("Mt. Freel", 2, ["water", "snack"]); diff --git a/chapter-02/07-es6-modules/text-helpers.js b/chapter-02/07-es6-modules/text-helpers.js new file mode 100644 index 00000000..8414677e --- /dev/null +++ b/chapter-02/07-es6-modules/text-helpers.js @@ -0,0 +1,4 @@ + +export const print = (message) => log(message, new Date()); + +export const log = (message, timestamp) => console.log(`${timestamp.toString()}: ${message}`);