Is there a C ++ to JavaScript compiler

Introduction to JavaScript: Programming Course

Bastian Gruber

JavaScript is one of the most important programming languages. With our introductory course, you will take the first hurdles and soon be able to write powerful scripts with JavaScript.

EnlargeJavaScript is also used on the PC-WELT website.

JavaScript has had a steep career since its invention in 1995 and standardization in 1997. With the introduction of NodeJS, the language has also found its way into the server side. However, on the server side, PHP is still the leading scripting language. JavaScript, on the other hand, ensures dynamism in the browser on the user's PC - i.e. on the client side.

Recently, JavaScript on Stack Overflow has even become the most widely used programming language worldwide. Stack Overflow is a question and answer platform on programming topics, where programmers from the areas of web programming and app development dominate. But Javascript also holds a leading position in the more neutral Tiobe index, although the constant upward trend from winter 2015 has ended for some time. In any case, JavaScript is an important and widely used programming language.

The right tool

So it makes sense to deal with the all-rounder. Especially since JavaScript is ideal for programming beginners. The command syntax of JavaScript is based on the programming language classic C (in contrast to C, JavaScript is not suitable for hardware-related programming, for example of microcontrollers).

Free professional website building tools

First of all, the only tools you need are a simple text editor and a browser.

You use the editor to write the JavaScript source code, which the browser then interprets (executes). So that the source code you have written in an editor can be executed on the computer, it must be translated into the machine language that the computer can read. There are basically two options for this “translation”: Interpretation and compilation (the latter for example with C and C ++), and with Java and C # a combination of both techniques. Javascript is one of the interpreted languages, the source code is processed here at runtime, which means: The source code is only converted into machine code when it is actually to be executed.

The ideal editor

If the text editor offers syntax highlighting for JavaScript - so much the better. For example, the free Notepad ++ editor is very suitable for writing the source code under Windows. If the editor even offers auto-complete for the source code, then that's perfect. The notepad and Wordpad editors integrated in Windows, on the other hand, are less suitable because these tools do not offer syntax highlighting and Notepad in particular is far too inefficient.

EnlargeUse Gedit to create the source code: Typical language components of JavaScript are highlighted in color. For that to be the case ...

For example, on Linux you can use Gedit. Or the also free Bluefish, with which you can also edit HTML and CSS. The best way to install these tools is through the package manager of your Linux distribution.

Enlarge... you have to select JavaScript beforehand. Select as highlighting mode.

Note: If you program professionally, you use an "integrated development environment", or IDE for short, to create the code. Examples are Eclipse or Visual Studio. But a simple text editor is sufficient for the beginning. We present suitable professional tools such as frameworks at the end of this article.

Webmaster tools for HTML, CSS, Javascript and web apps

In turn, you need the browser to display the result of your programming work. Whether you use Firefox, Chrome, Opera, Internet Explorer or Edge or any other popular browser for this, it does not matter at first. However, you should not use a pure text browser such as Lynx, because Lynx cannot display JavaScript.
History of JavaScript and delineation from Java

Version 2.0 of the former Netscape browser had an embedded scripting language. It was called LiveScript and was developed by Brendan Eich. With a contract with Sun Microsystems and the aim of supporting JavaApplets in the browser, Netscape created the necessary interface called LiveConnect. And from now on LiveScript was called JavaScript.

The JavaScript code is interpreted by the browser. JavaScript has nothing (!) To do with the Java programming language (once developed by Sun Microsystems. Oracle bought Sun in 2010), Java interprets and compiles the code (JIT compiler). With Java, for example, you can program Android apps or server-side applications, but also client software.

But enough of the preface, let's get started with our introduction to JavaScript.

JavaScript in the browser

In order to execute JavaScript in the browser, a so-called script element in the index.html file is sufficient (the index.html file forms the basis of every website):

The browser reads the Index.html file and executes it line by line. When the script element arrives, the code in it is interpreted as JavaScript and executed accordingly. To open an info window with the text “Hello World!” it is enough to write this code in an HTML file and open it in the browser:

<!doctype html>
<title>JavaScript Test</title>
<script>
alert ('Hello World!');
</script>

The alert command displays a small window with the text "Hello World". Click on "OK" to close the pop-up window.

EnlargeA useful tool is any browser's developer console. This allows individual JavaScript snippets to be typed in and tested. This can be seen like a pocket calculator: like an accountant, the JavaScript developer must be able to test smaller tasks and trains of thought somewhere quickly and securely.

The browser recognizes the JavaScript code based on the script element and interprets it with the help of the built-in JavaScript implementation, which all browser manufacturers adhere to the ECMAScript standard.

Application examples of JavaScript

The aim of JavaScript is to display website content more dynamically and to react to user actions. Starting with simple clicks on buttons to reloading content when reaching the bottom of the page. Through the direct implementation in the browser, JavaScript has access to the entire displayed window content.

HTML and JavaScript in a duet

Conversely, this also means: JavaScript in the browser is used to improve the user experience. Unlike on the server, there is always a bit of interaction with HTML code. Any number of JavaScript files (with the extension .js) can be created and these can be integrated via the following element: