Learn Javascript
Defining JavaScript
JavaScript is a scripting or a programming language, allowing developers to perform complex features on web pages. Initially, this language was created for making web pages alive. In JavaScript, the programs are called scripts. One can write them in the HTML of a web page, then it will automatically run once the page loads. At this point, JavaScript is completely different from another language, called Java.
Initially, when JavaScript was created, it was called “LiveScript”. Then, as Java was extremely popular in that period, then it was decided to call it JavaScript to position it relative to Java. But, over the years, JavaScript has transformed into a completely independent language, with its specification, known as ECMAscript, having no relation to Java. Modern JavaScript can both work in the browser and on the server. Basically, it can run on any device that has a specific program known as the JavaScript engine.
What In-browser JavaScript Does
Modern JavaScript is considered a safe programming language. It never provides low-level access to the memory or CPU as it was made for the browsers that don’t require it. The capabilities of this language highly rely on the environment it runs in. For example, Node.js includes functions allowing JavaScript to write and read arbitrary files, implement network requests, and so on. In-browser JavaScript does anything related to web page manipulation.
For example, with in-browser JavaScript, you can do the following:
- Adding new HTML to the page, changing the content, modifying the styles.
- Reacting to use actions, running on mouse clicks, key presses, and more.
- Sending requests over the network to remote servers.
- Getting and setting cookies, asking questions to visitors, sending messages.
- Remembering the data on the client-side.
Limitations of In-browser JavaScript
The capabilities of JavaScript are limited for the purpose of keeping the user’s safety. With it, an evil web page can’t access private information or harm the user’s data.
Here are some examples of such restrictions:
- JavaScript has no direct access to OS functions. It can’t read and write arbitrary files on the hard disc, copy or execute them.
- Different windows/tabs don’t recognize each other. JavaSCript from one page is not able to access the other one, in case they are from different sites. It’s known as “Same Origin Policy”.
- JavaScript allows communication over the net to the server from where the page comes from. But, its capability of receiving data from the other site is prohibited. That’s a safety limitation.
What Makes JavaScript Specific
There are at least three perfect things about JavaScript:
- It supports complete integration with CSS and HTML.
- It provides straightforward ways of doing simple things.
- It is supported by almost all the major browsers and is performed by default.
It is the exclusive browser technology that encompasses the three great things above.
In modern programming, JavaScript is the most widespread tool that helps to create browser interfaces. It also allows creating mobile applications, servers, and much more. Our JavaScript book consists of several sections that cover all the information you need to learn this unique programming language. Each of the chapters includes both the theory and practical cases to make it easier for beginners to grasp the language.