Saturday, 25 May 2024

Introduction

JavaScript ("JS" for short) is a full-fledged dynamic programming language that can add interactivity to a website. It was invented by Brendan Eich (co-founder of the Mozilla project, the Mozilla Foundation, and the Mozilla Corporation).

JavaScript was designed to 'plug a gap' in the techniques available for creating web-pages also.

HTML is relatively easy to learn, but it is static. It allows the use of links to load new pages, images, sounds, etc., but it provides very little support for any other type of interactivity.

JavaScript is versatile and beginner-friendly. With more experience, you'll be able to create games, animated 2D and 3D graphics, comprehensive database-driven apps, and much more!

JavaScript itself is relatively compact, yet very flexible. Developers have written a variety of tools on top of the core JavaScript language, unlocking a vast amount of functionality with minimum effort. These include:

  • Browser Application Programming Interfaces (APIs) built into web browsers, providing functionality such as dynamically creating HTML and setting CSS styles; collecting and manipulating a video stream from a user's webcam, or generating 3D graphics and audio samples.

  • Third-party APIs that allow developers to incorporate functionality in sites from other content providers, such as Twitter or Facebook.

  • Third-party frameworks and libraries that you can apply to HTML to accelerate the work of building sites and applications.

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:

  1. V8 – in Chrome and Opera.

  2. SpiderMonkey – in Firefox.

  3. There are other codenames like “Chakra” for IE, “ChakraCore” for Microsoft Edge, “Nitro” and “SquirrelFish” for Safari, etc.

 

What can in-browser JavaScript do?:

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.

JavaScript’s capabilities greatly depend on the environment it’s 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:

  1. Add new HTML to the page, change the existing content, modify styles.

  2. React to user actions, run on mouse clicks, pointer movements, key presses.

  3. Send requests over the network to remote servers, download and upload files (so-called AJAX and COMET technologies).

  4. Get and set cookies, ask questions to the visitor, show messages.

  5. Remember the data on the client-side (“local storage”).

 

What makes JavaScript unique?

There are at least three great things about JavaScript:

  1. Full integration with HTML/CSS.

  2. Simple things are done simply.

  3. Support by all major browsers and enabled by default.

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

That’s what makes JavaScript unique. That’s why it’s the most widespread tool for creating browser interfaces.

That said, JavaScript also allows creating servers, mobile applications, etc.

 

Summary:

JavaScript was initially created as a browser-only language, but it 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 in 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.

 

 

No comments:

Post a Comment

Interactive Report: Introduction to the Internet of Things (IoT) ...

Popular Posts