From d6f57ce09c4c0c449296f2d0e99abf845fdc5165 Mon Sep 17 00:00:00 2001 From: "Dawid Grochowski (PGS Software)" Date: Fri, 16 Mar 2018 13:55:08 +0100 Subject: [PATCH] JavaScript - ES6 Module system --- README.md | 1 + docs/index.html | 1 + docs/javascript/20-es6-module-system.html | 15 +++++++++++++++ docs/javascript/_include/21-export.js | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 docs/javascript/20-es6-module-system.html create mode 100644 docs/javascript/_include/21-export.js diff --git a/README.md b/README.md index 47baeef..47f9089 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Deployment to [Github pages](https://dgrochowski.github.io/frontend-upskilling/) - In ES6 you can marked `var` as deprecated - To declare objects and arrays you should use `const` (as often as possible) - If you cannot use `const`, use `let` +- `'use strict;'` mode will force you to create better quality code. Use it as often as you can. # Webpack diff --git a/docs/index.html b/docs/index.html index f982946..f308e75 100644 --- a/docs/index.html +++ b/docs/index.html @@ -46,6 +46,7 @@

JavaScript

  • Cookies, local storage, session storage
  • Async: timeout, interval, XMLHttpRequest (xhr), ajax, fetch
  • Regular expressions
  • +
  • ES6 - Module system
  • ES6 - let, const
  • diff --git a/docs/javascript/20-es6-module-system.html b/docs/javascript/20-es6-module-system.html new file mode 100644 index 0000000..87dd36b --- /dev/null +++ b/docs/javascript/20-es6-module-system.html @@ -0,0 +1,15 @@ + + + + + JavaScript - ES6 Module system + + + + +

    Check console (right click -> inspect -> console)

    + + diff --git a/docs/javascript/_include/21-export.js b/docs/javascript/_include/21-export.js new file mode 100644 index 0000000..91ea5a6 --- /dev/null +++ b/docs/javascript/_include/21-export.js @@ -0,0 +1,18 @@ +// function myFunction() { +// return 'something new here'; +// } +// +// // exports a function declared earlier +// export { myFunction }; +// +// // exports a constant +// export const foo = 'some constant var'; +// +// // default export function +// export default function() {} +// +// // default export class +// export default class {} + +// default export variable +// export default a = 'default var';