What is a programming language?
A programming language is the set of rules that defines the way in which source code is written. Unlike natural languages, these rules are quite strict. Any smallest mistake can cause the code not to run, or cause it to run and but somehow not work as expected. For example, you cannot write
Syntactically correct code is only half the battle. It can't be run directly by a computer as it's just text. A computer can only execute machine code (ones and zeros). There are two methods of converting source code into machine code. Compilation is the process of creating a ready-to-run program. Most of the programs we deal with as users were compiled by someone. For example, Windows uses the exe extension for compiled programs. Another method is interpretation. With interpretation, the source code is converted into machine code not before the program is run, but rather while it's being processed. This is why it is called interpretation.
The reality, however, is a bit more complicated than that: the interpretation is done by an engine embedded in both Node.js and browsers.
// node runs an interpreter which takes the source code index.js, // parses it, // then executes the code line by line node index.js
ECMAScript is constantly evolving. Each new standard describes more features of the language: some add new syntax, others add new built-in features to the standard library. For the most part, standards are backward compatible, i.e., code written according to ES3 will be executed by most interpreters. Unfortunately, it sometimes goes wrong. The code changes its behavior over time, usually towards having stricter rules.
It's important to understand the fact that having a feature in the standard does not automatically make it available in all interpreters. This is because the specification and interpreters are somewhat divorced from one another. Updates to the specification are usually followed on by interpreters, but it takes time. The reverse may be true as well: a new feature first appears in one of the interpreters and then, as it becomes popular, it enters the standard. If you run code written under a new standard on an interpreter that has not been updated for a long time, it will most likely crash upon encountering a syntax error.
There are sites (here and here) that show the availability of various features in different interpreters. Developers use them to find out whether it is safe to use new language features in their projects.
The Hexlet support team or other students will answer you.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.
Programming courses for beginners and experienced developers. Start training for free
Our graduates work in companies:
From zero to a developer. Refunds in case you won't get a job
Sign up or sign in
Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.