About compatibility issues with ES6

Source: Internet
Author: User

Why do ES6 have compatibility issues?

Because the majority of users use the browser version at the time of release may be earlier than the ES6 and release, and today, if we use the new features of ES6 in programming, if the browser does not have a newer version, or the new version of the ES6 features are not compatible, then the browser certainly does not recognize our ES6 code, Like a browser doesn't understand what I'm writing about let and what is const? can only be an error. This is the browser compatibility issue with ES6.

How to troubleshoot compatibility issues with browsers

<script>    var arr = ' I am an array '. Split (');     var [A,b,c] = arr;    Console.log (a,b,c); </script>

First of all, ie example, in the absence of the use of tools to convert in the IE browser will error

This is ES6 's grammatical error.

Testing found a tool to convert ES6 to ES5 syntax for compatibility

1. Introduction of <script src= "Https://cdn.bootcss.com/babel-standalone/6.26.0/babel.min.js" ></script>

2. Add the script tag on the package ES6 syntax

<script type= "Text/babel" ></script>

In this case, on IE can be executed, the effect is as follows:

About compatibility issues with ES6

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.