preface

Now we have implemented modular development, the introduction of a module, that is, the introduction of a file can be used globally, in the process of project writing, we can not write all the files into a file, so the file split

What is modularity

  1. The code or file is packaged into a module according to certain rules, and modules are independent of each other
  2. The internal data and methods of each module are private, allowing only exposed data that is intended to be used externally

What problem was solved

  1. Improved code reuse, better maintenance
  2. It can be loaded on demand and each module is independent
  3. Avoid space mutual pollution, naming conflict, the formation of isolation

The common methods are

Common. Js specification

es6 module

What are the differences