es6 understanding module

Js has not quite understand the module, done before java, python import other modules easily, js module to import people speechless, what require this, too disgusting.

Fortunately es6 language specification implemented on a module level function; but still a little different with other high-level language, people are less easy to remember

Wrote a book on the benefits of a bunch es6, do not write here, mainly to remember:

I want to use the module to remember a few commands:

1. export

2. import

3. export default

These three; export an interface to a specified output module, import references to other modules. I understood it;

Specific use

1. export written before the variable declaration is defined e.g.    Export var I = 0;  Export function V () {...}

2. define variables or process in the module. At the end of the module file to write a unified export {} output, the key is to have a {} can not be less

Guess you like

Origin www.cnblogs.com/caoyi/p/11387253.html