JS程式碼模組化(Module)是什麼?為什麼要模組化(module)?
阿新 • • 發佈:2019-01-29
之前接觸過AngularJS,現在看Dojo,都有對模組的使用。在dojo官網看到這段文字,覺得很好得對JS的模組化的必要性有所解釋,所以記錄下來:
What is a module?
A module is a value that can be accessed by a single reference. If you have multiple pieces of data or functions that you want to expose in a module, they have to be properties on a single object that represents the module. Practically speaking, it's overkill
to create a module for a simple value like var tinyModule = 'simple value';