2. What is JavaScript #

Created Wednesday 08 July 2020

Info #

What can JavaScript do #

In the browser

  1. Create, delete or modify any part of a webpage.
  2. React to user input: clicks, pointer movements, key presses.
  3. Get and set cookies.
  4. Save data in the browser’s “local storage”.
  5. Manage requests over the network, but only with the current domain.

Outside the browser(with node) Anything.

  1. Flying Drones
  2. Robotics

What Can’t JS do(in the browser) #

  1. Cannot read/write arbitary files to disk, except via the browser’s API, that too for upload/download.
  2. Different tabs/windows generally do not know about each other. 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. JS can still open new tabs and windows.
  3. No access to OS functions.
  4. Limited access to Camera/Microphone, provided explicitly by the user via the browser’s API.

Why use JavaScript #

Languages “over” JavaScript #

What is node #

JavaScript was experimented with and was found to be quite fast. Consequently, the node interpreter was developed, for running JS as a general purpose programming language outside of the browser.