JavaScript for Web Applications
Since Netscape created JavaScript to program dynamic HTML pages, its applications have been constantly expanding.
Its main function and scripting of the HTML page or GUI (see Qt, XAML, etc. This allows communication with the server via Ajax, WebSocket, WebRTC.
But also used to enable scripting in applications (Photoshop uses JavaScript) and even for system programming!

JavaScript was successively called Moka, then LiveScript, and finally, with Sun's consent, JavaScript .
JScript is a compatible version implemented by Microsoft in 2006 for Windows only.
Its construction is a mix of C and Self according to author Brendan Eich, who was also a lover of "The Scheme." The language has many flaws, but it's innovative and flexible, and while it dates back more than 20 years, it offers more options than most later languages like Dart. And implementers are working to address these shortcomings.
To complement ECMAScript 6, which makes JavaScript an independent application language, in 2015 Google proposed a SoundScript mode that also brings typed variables and various runtime accelerations. But this project was abandoned in February 2016 and the team was reassigned to Dart. However, typed variables are provided in a future version of ECMAScript.
A brief history of the language
- 1995. Created by Brendan Eich (In the same year as Java).
- 1996. Implementation in Netscape 2 browser.
- 1996. Microsoft implements a compatible JScart language in Internet Explorer 3.
- 1997. First ECMAScript standard.
- 1999. ECMAScript 3.
- 2009. ECMAScript 5.
- 2011. Google wants to replace JavaScript with Dart, but will admire it in 2015.
- 2012. Microsoft runs TypeScript, a JS set with classes that compiles into ECMAScript 5.
- 2013. Mozilla defines Asm.js, a subset of JS that can be used as a bytecode.
- 2015. Google offers SoundScript, a strict version that makes it easier to optimize for compilers .
- 2015. ECMAScript 6. Many elements are already implemented in browsers .
Inventive and innovative language
The format described here is ECMAScript 1.5, defined by ECMA in 1999. Later versions exist, but are not supported by all browsers.

Sample Code: Display Line Items
- The syntax of the language is similar to that of Java or C.
- Dynamic variables. Declared as "var," data of different types can be assigned to one variable. Firefox with version 9 introduces type output, due to which the compiler can treat variables as typical and significantly speed up processing.
- Object-oriented, uses page elements as objects. Objects are dynamic.
- Legacy by prototype.
- Without file management and I/O functions (except dialogs).
The function of writing to a local file is included in HTML 5 or with Node.js. - Navigator management.
- Events.
- Dynamic and associative tables.
- Primitives (undeclared): boolean, string, number, date.
- Date, Math, RegExp objects are predefined.
- Construction for.. in command allows you to scan an associative table .
- Functions are declared with the function keyword, without the optional return type. They are called first-class, in other words, they can be used as components of a language, therefore assigned to variables, included in structures (for example, methods).
- ALGOL operators 68/C plus: = = = and! = =, comparison by value and by type .
- Page elements reference a hierarchy of objects, including objects from the document model (DOM, W3C standard): Document, window, form, table, etc.
- Hoyting: what is declared inside the space of sight has its statement transferred at the beginning. For example, if a variable is declared somewhere in the function, it will actually be declared at the beginning. Similarly, features are available in any script, as they are declared at the beginning of the script .
Some language flaws...
- Cannot replace character in string.
- Adding a string and a number is not symmetric. In one case, this returns one row, in the other, a number.
- Boolean comparisons are not consistent .
- The array constructor argument can be either the number of elements or the list of elements.
ECMAScript 7 for critical and modular applications
New versions of JavaScript, while maintaining compatibility, make this language a safer tool for developing large-scale applications. ES6/ES7 code can be written and translated for compatibility with any browser, such as TypeScript (Microsoft), Tracer (Google) or Babel.
- let const.
They are used to declare a variable or constant either globally or locally. Let allows you to declare a variable visible only in the instruction block, while var, even declared in the interrupt block, is visible throughout the body of the function .
Let is similar to with with increasing performance because it avoids creating a dynamic object as with. - Map.
Associative table or keys are objects, but are not counted by the collector. We can return the list of keys. The value can be found on the receive and key/value pair added by the dialing method. - WeakMap.
This is an associative table in which keys cannot be numeric to associate data with a list of objects.
Keys are objects available to the garage collector, and it is impossible to get a list of keys without building it yourself. - Set.
Contains a list of values, such as a table, but must be unique.
Map and WeakMap have a method that is not capitalized. The set has add and has methods, but no method to get the element directly. - WeeklySet
Array of unique objects. - Proxy.
Another source of confusion: here it is a JavaScript meta-object, or virtualized object. The behavior must be fully defined by the programmer. By creating a proxy for another object, you can intercept its properties through a proxy, for control, debugging or something else. - Module.
By encapsulating the contents of the file in the {} module or can import it in whole or in parts for elements preceding the reserved word export. Works like Node.js. Attached is the Loader API for loading modules. - Class... expansion
Inherited classes are implemented with the current objects. Only attributes can be defined in the designer. Section 14.5. - Array.from
Overrides the current new array constructor error (in. Using a parameter that is an array, the length property determines the size of the array to be created . - For.. about
Lists the values of the properties of the associative table. for (var v of x) replaces:
for(var k in x) { var v = x[k]; }
- You can also get key pairs/values with: for (var [k, v] of x.
- Function * and yield
This type of function is coroutin. Keyword yield indicates a goal that scores an end. This replaces Node callbacks while maintaining asynchronous mode. (Chapter 13.4 of the specification). - Functions will also have default values for omitted arguments.
- I promise. Object that should contain the result of a remote or asynchronous operation.
- Asynk/avant. Synchronizes asynchronous functions.
- Template (line animation)
A new literal string type can be written to multiple strings and include variables. - Arrow. A new formulation for the lambda function, which can be written in two forms below.
function(a, b) { return a + b }
(a, b) => a + b - The main functions of the 2017 version are asynchronous/await and shared memory and atomic.
- Shared Array Buffer and Atomics are the foundations for competing programming .
- The language becomes more functional with Object.value and Object.entries, which allow you to enumerate table elements or object properties.
Some new features have already been implemented in a particular browser. To find out what is implemented in the browser, use it to view tests of the implementation of new JavaScript functions.
To enable some of these features in Chrome, you need to enter chrome: flags and Enable Experimental JavaScript.
Reference: Standard ECMA specifications for 7th Edition. 2016.
Which JavaScript interpreter for which browser
?Browsers compete on JavaScript engines, as well as on rendering engines... But now it is more JIT compilers than interpreters...
- V8. Chrome compiler and Node.js.
- JavaScriptCore. WebKit и Safari. It is also given other trade names: Nitro, SquirrelFish. But it's the same .
- SpiderMonkey. В Firefox.
- IonManki. A specific JIT for Firefox (since 18 years old) that runs only on Asm.js code. Fastest in May 2014.
Hashorn produces baytecode for JVM. Built into no major browser.
System language
?With the advent of JavaScript compilers, working both in the browser and as an independent tool, new ways of using this language, close to C, but freer and with automatic memory management, sandbox, appear.
- JSLinux.
This project allows you to run Linux in a browser. Programs can be edited, compiled, and run on the command line. - LLVM.js.
In JavaScript, you can compile any LLVM language (C++, Julia): LLVM bitcode is translated into JavaScript via LLVMjs .
Does JavaScript work on mobile devices?
The controversy was sparked by Drew Crawford's article that JavaScript is too slow because mobile devices have little memory compared to desktop computers.
But other language experts disagree and believe the culprit is not language but DOM. DOM is known to be slow, so some frameworks like Angular have implemented data-binding, which allows you to update content without going through it.
The author clarifies that in fact JavaScript can be faster than other languages like Objective-C (used on iOS) when exchanging messages, as this is what works better with JIT than with static compilation.
In the end, the author explains the speed of native iOS applications by the fact that the screen has a unique size, unlike Android or other systems.
While the language is relatively easy to learn, it has dark points, to the point where we have books specialising in the right parts of the language and others specialising in the hard aspects.
- French JavaScript tutorial
With syntax descriptions, examples and demonstrations. Mostly the good parts... - JSON.
Syntax format for JavaScript data. - ECMAScript.
1999 JavaScript language specifications. - The Future of JavaScript
Brendan Eich, slideshow describes language development. The point is that JS is suitable for applications, libraries and replaces the virtual machine . - List of languages with compiler in JavaScript
The list is impressive and includes Go, Dart, Python, Ruby, Java, Scala, Basic, Pascal, C and C++ via Emscribtem .
- TypeScript. (Microsoft) Designed to extend JavaScript to the same syntax.
- Plotter. ECMAScript 6 in 5 compiler from Google.
- Scriptol. Full support for Script with reactive programming.
- Emscribtem compiles LLVM bytecode into JavaScript. So any language compiled by LLVM like C++ can be converted to JavaScript and run in a browser. Go can be converted using Gopherjs.
- Babel. (Ex 6to5) Allows you to write code in ES6 or ES7, with classes, getters, default argument values, it will be compiled into classic JS.
You can develop an application in JavaScript under LightTable (see frame above), Eclipse, NetBeans or Aptana, or a text editor for a simple script.
- Karma.
Through Google tests the code for all browsers, starting with the editor . - JSLint is an online JavaScript code testing and error detection tool (by the creator of JSON).
- Ductape
JavaScript engine to inject into an application in C or C++ to add scripting capability or dynamic code. It is enough to add duktape.c and duktape.h to the list of project sources. Then you can call the JS 5 functions from C and vice versa.
- Node.js.
The V8 compiler is used in the command line with Node (see the JavaScript section of this site), and uses NPM libraries.
Electron combines Node and Chrome browser for local applications.
To develop a serious application, it is recommended to use the Ajax or HTML 5 framework. There are also frameworks for mobile devices.
- River Trail.
JavaScript extension in the form of a plugin that provides parallel programming. For example, in WebGL, it allows you to simultaneously manage thousands of objects. - HTML frameworks 5
JavaScript libraries using Canvas. - Game engines
They do half the development. - Algorithm and data structures.
Compilation on GitHub.
JavaScript becomes Linux application language
Linux
Obviously, this causes protests, because each developer has his own favorite language (C, Python, Ruby, etc.), which he would like to see for this role.
Another reference environment, KDE, being based on Qt, also uses JavaScript for the interface and C++ for applications. However, the Plasma interface, which is analogous to Metro for Linux, allows you to quickly create applications in JavaScript using the Plasmate IDE.