What is JavaScript? JavaScript And ECMAScript, Explained – GKZ Hitech

JavaScript is a very popular interpreted scripting language that, by early 2019, has become the most frequently learned language by developers. JavaScript is an open standard, not controlled by a single provider, with many implementations and an easy-to-learn syntax that makes it popular with both novice and experienced developers.

JavaScript dates from the early days of the World Wide Web. The language was first implemented to add light client-side functionality to web pages. It is widely used today for this purpose. Today, just about anything interactive or animated on a web page is rendered in JavaScript, including all of the online advertising and statistics ecosystems. But JavaScript doesn't just work in the browser. Using development infrastructures such as Node.js, JavaScript is now used to write code for any niche imaginable, from clients to servers to the cloud.

Defined JavaScript: What is a scripting language and how are Java and JavaScript different?

As the name suggests, JavaScript is a script language. Traditional languages ​​such as C ++ are compile before they are executed in an executable binary form, the compiler checks for errors in the whole program before the end of the process. Scripting languages, on the other hand, are executed one line at a time by another program called a perform. Scripting languages ​​started as simple series of shell commands used to run other programs, but their flexibility and ease of use made them a well-known type of programming language, especially important with the rise of Web.

JavaScript itself appeared in the early days of the web, and its history explains the somewhat anomalous nature Java part of his name. In 1995, Netscape had just signed an agreement with Sun Microsystems to become the first licensee of Sun's Java language, allowing it to run Java applets in the pioneering and dominant Web browser of Netscape Navigator. However, some members of society believed that it was also important to support a lighter scripting language in Navigator. Brendan Eich, a Netscape employee at the time, explained:

There were people who strongly argued that Java was good for programmers who build components, but there is a much larger audience of people who write scripts or maybe copy a script from someone else and the tweak. These people are less specialized and can be paid to do something other than programming, like administering a network, and write part-time or side scripts. If they write small pieces of code, they just want to get their code with minimal complications. "

Eich was cautious: Java applets never really took off, while the scripting language he created (very quickly) for Netscape remains the backbone of interactive websites. Originally called LiveScript, the language was created with a superficially similar Java syntax in order to tap into the Java developer community, although there is in fact no direct relationship between the two languages. However, since Netscape had already signed an agreement with Sun just before its release, the language was renamed JavaScript and billed by the two companies as a supplement to the Java language.

In 1997, the European Association of Computer Manufacturers (ECMA) published a standard defining the language that anyone can use independently of Netscape; Because Java remained a brand of Sun that only Netscape was allowed to use, this standardized version was called ECMAScript. Microsoft had qualified the version implemented in Internet Explorer of JScript. However, these names have long since fallen out of general use, although ECMAScript remains the official name of the standard, which has been revised many times over the years to take into account the improvement in processing power and Internet bandwidth. In practice, everyone refers to the language as JavaScript. Technically, only the Mozilla Foundation (which took over intellectual property from Netscape in 2003) officially authorized Oracle (which acquired Sun in 2010) to use the Java brand, but Oracle has made no effort to prevent the universal use of the last name. .

Enable JavaScript

Since its beginnings in JavaScript, it was not uncommon for browsers to disable the execution of JavaScript by default. Today, most of the web would remain unusable, because JavaScript is an integral part of almost all professionally designed web pages. If for any reason you suspect that JavaScript has been disabled in your browser, this is an excellent page which gives detailed instructions for enabling it. (You can also reverse these instructions to disable JavaScript to give you an idea of ​​how sad the world is without that.)

Download JavaScript

What if you want to play with JavaScript today? Well, because it is an interpreted language, there is really nothing you need to download. You can launch your favorite text editor and start typing code! There is a JavaScript interpreter built into any browser that you can name that can execute commands. So you can just embed your JavaScript in an HTML document and load it for testing.

If you want to run JavaScript code in a desktop environment, which will give you access to the file system, because JavaScript running in the browser is deliberately sandboxed for security reasons, you can then: Download Node. js.

javascript editor

Of course, most developers will not just type the code by hand in a text file. We have come to accept software assistance during the creation of our software. InfoWorld has everything you need for JavaScript: we've put together a list of the top 10 JavaScript editors available. These range from Sublime Text, a text editor with syntax highlighting and several windows to help you navigate your files, Visual Studio Code, a complete IDE from Microsoft. Most of the options we are discussing are open source and free.

JavaScript syntax: the basics

What goes into a JavaScript application? Let's take a closer look at some of the basic components of JavaScript syntax, with links to the W3Schools JavaScript Reference where you can find more details:

  • JavaScript operator: These are the building blocks of the functionality of the program. These are the basic arithmetic operators from which you build mathematical functions and assignment operators allowing you to define the value of the variables.
  • JavaScript function: A function is a standalone block of code that you write to perform a specific task. Some are built into the language, while others allow you to write yourself to run the logic of your application. Once you have defined it, you can call the function (invoke it and possibly transmit certain variables or data on which you wish to work) elsewhere in your program.
  • JavaScript substring (): A method that extracts the characters you specify inside a chain and generates a new chain composed only of these characters.
  • JavaScript array: A special type of variable that can contain a whole list of values ​​at once. JavaScript has a number of tools for finding and manipulating the specific values ​​you want in an array. For example…
  • JavaScript for each (): This method calls a specified function once for each element of an array, in order.
  • JavaScript Map (): Something of a variation on forEach (), a card creates a new array containing the results of calling a function on each value of another array. For example, you can multiply all values ​​in another table by 10.

Learn JavaScript with JavaScript tutorials

Obviously, if you really want to become a JavaScript developer, you will want to go further. The W3Schools reference is perfect for delving into details on individual elements of JavaScript syntax, but there are other more systematic tutorials:

JavaScript Snake is a great specific example of what you can do with JavaScript. It is a simple and classic game that can be built to work in the browser using only JavaScript, HTML and CSS. This tutorial by Panayiotis Nicolaou shows you how.

JavaScript interview questions

Due to the growing popularity of JavaScript, many hiring managers expect candidates to be able to write it and often ask candidates to write JavaScript code immediately during the interview. If you are trying to prepare an interview of this type, you can find online a multitude of lists of typical questions… Toptal has a good example, but for a more global approach, we recommend this essay by Naren Yellavula on dev.bits ( ). This is a mini JavaScript tutorial, but it deals specifically with the basics you need to successfully solve the type of questions that arise most often in interviews. Take the time to read it and good luck!