Home  >  Article  >  Web Front-end  >  Does ie8 support es6?

Does ie8 support es6?

青灯夜游
青灯夜游Original
2022-04-19 14:00:402944browse

ie8 does not support es6. In the IE browser, IE10 and below versions do not support es6 at all and cannot parse the syntax of es6, while IE11 can support some es6 features. You can check whether the IE browser supports es6 by judging whether it supports arrow functions. If not, Supporting arrow functions means that the browser does not support ES6.

Does ie8 support es6?

The operating environment of this tutorial: Windows 7 system, ECMAScript version 6, Dell G3 computer.

ie8 does not support es6.

In the IE browser, IE10 and below versions do not support es6 at all and cannot parse the syntax of es6, while IE11 can support some es6 features.

Browser versions that support ES6 (summary table):

FirefoxChromeSafari OperaiOS SafariOpera Mini##Android Browser 4.4-4.4.481Opera MobileChrome for Android##87##12.124QQ Browser10.47.122.5Implementation ideas:
Browser Unsupported versions Partially supported version Supported version
IE 6-10 11
##Edge
##12-14
15-18, 79-87
2-5 6-53 54-86
4-20 21-50 51-90
3.1-7 7.1-9.1 10-13.1, 14, TP
10-12.1 15-37 38-72
3.2-6.1 7-9.3 10-13.7, 14.2
all

2.1-4.3
12-12.1 59


Firefox for Android

##83

##UC Browser for Android

Samsung Internet
5-13.0

Baidu Browser

KaiOS Browser

How to determine whether a browser supports ES6?

By judging whether a browser supports arrow functions, if arrow functions are not supported, it means that the browser does not support ES6

The implementation steps are as follows:
  • 1. Define a string and assign an arrow function to the string

    2. Use try catch determines whether the new Function can be successfully initialized arrow function
When you do not enter the catch, it means that the browser supports ES6; otherwise, the browser does not support ES6, as shown in the following example:

Example:

Example sharing for detecting whether the browser supports ES6

Test environment: IE, Chrome

document.write("浏览器是否支持ES6的检测方法");
var  arrowFunction ="var t = () => {};" ;
 try
 {
	f = new Function(arrowFunction);
    document.write("当前浏览器支持ES6!");
 }
 catch (e)
 {
  document.write("不支持ES6! "+e);
 }

[Related recommendations:

javascript video tutorial

,

web front end

The above is the detailed content of Does ie8 support es6?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn