1

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?

Community
  • 1
  • 1
NoBugs
  • 9,310
  • 13
  • 80
  • 146
  • Firefox already supports it in the Web console. For Chromium, see http://stackoverflow.com/a/17253177/938089. – Rob W Jul 07 '13 at 10:57

3 Answers3

2

Works for me in the Firefox console.

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

let x = 3; undefined x 3

Rob W
  • 341,306
  • 83
  • 791
  • 678
0

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.

Community
  • 1
  • 1
Rafael Fontes
  • 1,195
  • 11
  • 19
  • 1
    Thank, but I know it supports JS1.7, the question is, how to use it without making a new script tag in a document, with the `type="application/javascript;version=1.7"` attribute. – NoBugs Jul 06 '13 at 04:46
0

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);
Walter Fuchs
  • 167
  • 2
  • 11