How one can determine JS version using only js functions, without calls navigator/agent?
For example, codeforces.com has a JS as one of the possible languages for problem solutions, however, it uses outdated d8 instead of nodejs for some reasons. Since JS actively goes to the backend and becomes general purpose scripted language I guess this determination code can be somehow useful.
-
1Note that the JavaScript version is not the same as the ECMAScript version.Fabian Klötzl– Fabian Klötzl2017年03月17日 12:50:52 +00:00Commented Mar 17, 2017 at 12:50
-
Sicne the line between Javascript versions depends also on the browser used, it's probably better to use feature detection. Test for the existance of the features you want to use.Shilly– Shilly2017年03月17日 12:54:59 +00:00Commented Mar 17, 2017 at 12:54
-
What exactly do you mean by "JS version"? Does it have anything to do with v8?Bergi– Bergi2017年03月17日 13:11:35 +00:00Commented Mar 17, 2017 at 13:11
2 Answers 2
As far as i know nodeJS uses v8. (https://developers.google.com/v8/) there is a related topic here (Detect version of JavaScript)
Comments
Feature detection is the way to go.
The reason is that all modern JavaScript implementations have adopted a development/release strategy where they work on new features in parallel and ship them when they are ready. So there is no (usually) no specific point in time where a given browser or node.js switches from "not supporting ES2017" to "supporting ES2017", it's more likely that they're in a state of "most ES2017 features are supported already but some are still missing or incomplete".