• Complain

Ilya Kantor - Javascript.info

Here you can read online Ilya Kantor - Javascript.info full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Ilya Kantor Javascript.info

Javascript.info: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Javascript.info" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Ilya Kantor: author's other books


Who wrote Javascript.info? Find out the surname, the name of the author of the book and a list of all author's works by series.

Javascript.info — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Javascript.info" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
An Introduction to JavaScript

Source:https://javascript.info/intro

Lets see whats so special about JavaScript, what we can achieve with it, and which other technologies play well with it.

JavaScript was initially created to make web pages alive.

The programs in this language are called scripts. They can be written right in a web pages HTML and run automatically as the page loads.

Scripts are provided and executed as plain text. They dont need special preparation or compilation to run.

In this aspect, JavaScript is very different from another language called Java.

Why is it called Java Script?

When JavaScript was created, it initially had another name: LiveScript. But Java was very popular at that time, so it was decided that positioning a new language as a younger brother of Java would help.

But as it evolved, JavaScript became a fully independent language with its own specification called ECMAScript, and now it has no relation to Java at all.

Today, JavaScript can execute not only in the browser, but also on the server, or actually on any device that has a special program called the JavaScript engine.

The browser has an embedded engine sometimes called a JavaScript virtual machine.

Different engines have different codenames. For example:

  • V8 in Chrome and Opera.
  • SpiderMonkey in Firefox.
  • There are other codenames like Trident and Chakra for different versions of IE, ChakraCore for Microsoft Edge, Nitro and SquirrelFish for Safari, etc.

The terms above are good to remember because they are used in developer articles on the internet. Well use them too. For instance, if a feature X is supported by V8, then it probably works in Chrome and Opera.

How do engines work?

Engines are complicated. But the basics are easy.

  1. The engine (embedded if its a browser) reads (parses) the script.
  2. Then it converts (compiles) the script to the machine language.
  3. And then the machine code runs, pretty fast.

The engine applies optimizations at each step of the process. It even watches the compiled script as it runs, analyzes the data that flows through it, and further optimizes the machine code based on that knowledge.

Modern JavaScript is a safe programming language. It does not provide low-level access to memory or CPU, because it was initially created for browsers which do not require it.

JavaScripts capabilities greatly depend on the environment its running in. For instance, Node.js supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.

In-browser JavaScript can do everything related to webpage manipulation, interaction with the user, and the webserver.

For instance, in-browser JavaScript is able to:

  • Add new HTML to the page, change the existing content, modify styles.
  • React to user actions, run on mouse clicks, pointer movements, key presses.
  • Send requests over the network to remote servers, download and upload files (so-called AJAX and COMET technologies).
  • Get and set cookies, ask questions to the visitor, show messages.
  • Remember the data on the client-side (local storage).

JavaScripts abilities in the browser are limited for the sake of the users safety. The aim is to prevent an evil webpage from accessing private information or harming the users data.

Examples of such restrictions include:

  • JavaScript on a webpage may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS functions.

    Modern browsers allow it to work with files, but the access is limited and only provided if the user does certain actions, like dropping a file into a browser window or selecting it via an tag.

    There are ways to interact with camera/microphone and other devices, but they require a users explicit permission. So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to the NSA.

  • Different tabs/windows generally do not know about each other. Sometimes they do, for example when one window uses JavaScript to open the other one. But even in this case, JavaScript from one page may not access the other if they come from different sites (from a different domain, protocol or port).

    This is called the Same Origin Policy. To work around that, both pages must agree for data exchange and contain a special JavaScript code that handles it. Well cover that in the tutorial.

    This limitation is, again, for the users safety. A page from http://anysite.com which a user has opened must not be able to access another browser tab with the URL http://gmail.com and steal information from there.

  • JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is crippled. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, thats a safety limitation.

Such limits do not exist if JavaScript is used outside of the browser, for example on a server. Modern browsers also allow plugin/extensions which may ask for extended permissions.

There are at least three great things about JavaScript:

  • Full integration with HTML/CSS.
  • Simple things are done simply.
  • Support by all major browsers and enabled by default.

JavaScript is the only browser technology that combines these three things.

Thats what makes JavaScript unique. Thats why its the most widespread tool for creating browser interfaces.

That said, JavaScript also allows to create servers, mobile applications, etc.

The syntax of JavaScript does not suit everyones needs. Different people want different features.

Thats to be expected, because projects and requirements are different for everyone.

So recently a plethora of new languages appeared, which are transpiled (converted) to JavaScript before they run in the browser.

Modern tools make the transpilation very fast and transparent, actually allowing developers to code in another language and auto-converting it under the hood.

Examples of such languages:

  • CoffeeScript is a syntactic sugar for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
  • TypeScript is concentrated on adding strict data typing to simplify the development and support of complex systems. It is developed by Microsoft.
  • Flow also adds data typing, but in a different way. Developed by Facebook.
  • Dart is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.

There are more. Of course, even if we use one of transpiled languages, we should also know JavaScript to really understand what were doing.

  • JavaScript was initially created as a browser-only language, but is now used in many other environments as well.
  • Today, JavaScript has a unique position as the most widely-adopted browser language with full integration with HTML/CSS.
  • There are many languages that get transpiled to JavaScript and provide certain features. It is recommended to take a look at them, at least briefly, after mastering JavaScript.
Manuals and specifications

Source:https://javascript.info/manuals-specifications

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Javascript.info»

Look at similar books to Javascript.info. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Javascript.info»

Discussion, reviews of the book Javascript.info and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.