-1

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.

lebed2045
  • 428
  • 2
  • 7
  • 15
  • 1
    Note that the [JavaScript version](https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/Firefox_JavaScript_changelog) is not the same as the ECMAScript version. – Fabian Klötzl Mar 17 '17 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 Mar 17 '17 at 12:54
  • What exactly do you mean by "JS version"? Does it have anything to do with v8? – Bergi Mar 17 '17 at 13:11

2 Answers2

0

As far as i know nodeJS uses v8. (https://developers.google.com/v8/) there is a related topic here (Detect version of JavaScript)

Community
  • 1
  • 1
ayxos
  • 408
  • 1
  • 7
  • 15
0

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".

jmrk
  • 34,271
  • 7
  • 59
  • 74