Amd,cmd,common.js and ES6 Simple comparison

Source: Internet
Author: User

AMD is the normalized output of the module defined by Require.js in the promotion process.

1. Relying on the predecessor

function  (Alpha) {  returnfunction() {  return alpha.verb () + 2;   }  }; });

CMD is the normalized output of the module definition in the sea.js process.

1. Reliance on the nearest

Define (function(require, exports) {  //  get module A's interface  var a = require ('./a ')  ; // method of calling module a   a.dosomething ();});

Common.js specification front-end browser is not supported, usually using this specification on server node

Output: Exports. method

Node provides a exports variable for each module, pointing to Module.exports

Module.exports

module.exportsproperty represents the external output interface of the current module, and the other file loads the module, actually reading the module.exports variable.

ES6

Export default {} defaults output

Import input

Amd,cmd,common.js and ES6 Simple comparison

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.