Frage

I was wanting to test some things with let statement in the console, but I ran into a problem - it isn't supported in Firefox or Chromium. I know it's supported, if you set the javascript version in a script tag, but is there any option that will let you make sure the latest version of Javascript is enabled in the web console (or Scratchpad) of Firefox and/or Chromium?

War es hilfreich?

Lösung

Works for me in the Firefox console.

Cmd + Shift + K to bring up the console and:

let x = 3; undefined x 3

Andere Tipps

I think there's no such thing as a window.version or something like that... the common way is by checking like posted in Detect version of JavaScript

or even better heck out Modernizr, which is a great library that does feature detection for you.

In Chrome you have to activate JavaScript Harmony,"chrome://flags" enable-javascript-harmony

and use the strict mode "use strict";.

Here's a simple example:

"use strict";
let square = "trololo";
console.log(square);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top