Quickstart with ECMAScript
Before starting fast with ECMAScript you should spend some time reading my introduction post on the ECMAScript, it provides you a better overview:
The ES6 (ECMAScript 6) specification was announced in June 2015. It needs to wait for a period of time so that browsers support all new features. Therefore, to study ES6 and be able to practise, you have 3 approaches:
To study ECMAScript, you need to have an environment to execute the code written by you. It is the simplest to use an online tool, for example, the following website:
To study ES6, you need only a browser. It's best to download the latest version of Chrome, Firefox, or Safari. At present, these browsers support all ES6 features.
You can look up browser support for ES6 at the following link:
Therefore, I advise you to install the NodeJS:
To write the ECMAScript code, you can use any "Text Editor" . I recommend that you use the Atom editor, which is a free, open source editor provided by the GitHub.
As I say above, to learn the ECMAScript, you need an environment to execute the code written by you. It is the most simple to search a online tool to execute the ECMAScript code, for example, the following website:
Write your ECMAScript and click on the button to execute it.
This tool also allows you to see how the code written by ES6 is converted into ES5 code.
As I say above, to study the ECMAScript, you need only one browser, for example, Firefox, Chrome, Safari, and should use the latest version.
Create a HTML file, for example, hello.html:
Open the hello.html file on browser and you can see the results on the Console window of the browser.
First of all, create an empty directory, such as node-ecmascript. Open the CMD and CD windows to enter the directory which you just created, and execute the following command to initialize a project:
# Init project: npm init
Accept default options. Press Enter, Enter,... Enter until completion:
A package.json file has been just created in your directory.
Open your project directory on an editor. Here I use Atom.
Create a hello.js file:
You have 2 ways for running this file:
Way 1: Open CMD window and run the following command: