This article contains some of the good solutions for this.
Though browsers don’t have full support for ES6, but there are few tools which converts your ES6 codes to equivalent ES5 vanilla code; which runs fine in browsers. The online playgrounds below does the same and help you to test ES6.
Babel Repl is a playground for ECMA script 6; where you can write ES6 code, check the relevant code in ES5; and also the output. Babel is probably the best and easiest solution to test your ES6 code today.
Command line solutions:
You can also test ES6 in your command prompt or terminal. Just like using the node command. Few of the solutions are given below.
Babel also has a npm module; installing which you can easily rum ES6 codes in your command window. Below are the steps to make your terminal ready for ES6 with babel.
$ npm install --global babel
// write your ES6 code here
Traceur provides a command line interface too for experimenting with ES6 codes. The name of the npm module is traceur-cli. Below are the steps.
$ npm install --global traceur-cli
traceur> //write your code here
ECMA Script 6 on browsers
Though browsers don’t have full support of ES6, but they have started implementing the same. You can find which browser support what features of ES6 from here.
Run ES6 on Mozilla Firefox
Open firefox developer tools and you can test certain ES6 properties/features of ES6.
Run ES6 on Google Chrome
Once you enable it and restart chrome, you will be able to test your ES6 code in Chrome console (only the features implemented by chrome).
However, most of the features are reserved for only “scrict mode”. So, you have to run your code in scrict mode only. Below is a code example to run in strict mode.
let x = 10;
let x = 1;
console.log("Condition true output: "+testX(true));
Scratch JS is a browser extension available for Chrome and Opera. This plugin internally uses Babel and Trecure (you can select any of them from the setting of that plugin) and runs your script right there in your developer tools.