Explain major differences between the ES5 and ES6 syntax with relevant examples

Posted by Andre Scott | Updated on

The syntax has witnessed a great change from ES5 to ES6. Important differences between the two releases of ECMAScript are:

  • Require vs. Import – The require used in ES5 is now replaced with import.var React = require(‘react’); //is now replaced with
    import React from ‘react’; //in ES6
  • Export vs. Exports – Instead of exports, now export is used.export default Component; // replaces
    module.exports = Component; // in ES6
  • Component and Function – The use of component and function has also changed from ES5 to ES6.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers