I want to see what ECMAscript version I'm using in my browser(e.g,chrome 59) ,because there is some difference between ECMAscript3 and ECMAscript5 when dealing with something RegExp stuff.
I've found the relevant information about this,but I can't find a specific answer about how to detect the ECMAscript version.
Thank's in advanced.
This Standard defines the ECMAScript 2022 general-purpose programming language.
ES6 is also known as ECMAScript 2015 as it is released in 2015. Its class allows the developers to instantiate an object using the new operator, using an arrow function, in case it doesn't need to use the function keyword to define the function, also return keyword can be avoided to fetch the computer value.
The JavaScript family is ever-evolving and is set to launch new JavaScript features in June 2022. The ES2022 will be the 13th edition of features after it was initially launched in 1997. The ES2022 features that reach the stage 4 verification are added to the JavaScript family.
ECMAScript 5 on IE is fully supported on 10-11, partially supported on 9-9, and not supported on 5.5-8 IE versions. ECMAScript 5 on Edge is fully supported on 12-103, partially supported on None of the versions, and not supported on below 12 Edge versions.
May be you can try to use some data structures that are specifically added in ES6
like Map
, Set
etc. This is to differentiate between ES5
and ES6
but you can look up for features that are added in ES5
which are not present in ES3
in your case?
try {
var k = new Map();
console.log("ES6 supported!!")
} catch(err) {
console.log("ES6 not supported :(")
}
try {
var k = new HashMap();
console.log("ES100 supported!!")
} catch(err) {
console.log("ES100 not supported :(")
}
I don't think that's possible because browsers normally don't implement all features of an ECMAScript version at once. That's why we have libraries like Modernizr and websites like Can I use ... to find out what features can be used.
You could still build a little test that determines how RegEx in the user's browser version behaves.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With