JavaScript

Niharika Dhanik
5 min readJun 25, 2021

--

JavaScript —

JavaScript was introduced in 1995 as a way to add programs to web pages in the Netscape Navigator browser. The language has since been adopted by all other major graphical web browsers. It has made modern web applications possible — applications with which you can interact directly without doing a page reload for every action. JavaScript is also used in more traditional websites to provide various forms of interactivity and cleverness.

JavaScript has strong object-oriented programming capabilities, even though some debates have taken place due to the differences in object-oriented JavaScript compared to other languages.

JavaScript is a cross-platform, object-oriented scripting language used to make webpages interactive (e.g., having complex animations, clickable buttons, popup menus, etc.). There are also more advanced server side versions of JavaScript such as Node.js, which allow you to add more functionality to a website than downloading files (such as realtime collaboration between multiple computers). Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control over them.

JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it with additional objects; for example:

  • Client-side JavaScript extends the core language by supplying objects to control a browser and its Document Object Model (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events such as mouse clicks, form input, and page navigation.
  • Server-side JavaScript extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a database, provide continuity of information from one invocation to another of the application, or perform file manipulations on a server.

This means that in the browser, JavaScript can change the way the webpage (DOM) looks. And, likewise, Node.js JavaScript on the server can respond to custom requests from code written in the browser.

Common examples of JavaScript uses and applications include:

  1. Presentations
  2. Web Development
  3. Server Applications
  4. Web Applications
  5. Games
  6. Mobile Applications

The Relationship Between JavaScript & Java —

JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java’s static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.

In contrast to Java’s compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.

JavaScript is a very free-form language compared to Java. You do not have to declare all variables, classes, and methods. You do not have to be concerned with whether methods are public, private, or protected, and you do not have to implement interfaces. Variables, parameters, and function return types are not explicitly typed.

Java is a class-based programming language designed for fast execution and type safety. Type safety means, for instance, that you can’t cast a Java integer into an object reference or access private memory by corrupting Java bytecodes. Java’s class-based model means that programs consist exclusively of classes and their methods. Java’s class inheritance and strong typing generally require tightly coupled object hierarchies. These requirements make Java programming more complex than JavaScript programming.

In contrast, JavaScript descends in spirit from a line of smaller, dynamically typed languages such as HyperTalk and dBASE. These scripting languages offer programming tools to a much wider audience because of their easier syntax, specialized built-in functionality, and minimal requirements for object creation.

Industry Use Case Of JavaScript —

One of the important use case of Javascript with reference to Mobile Application is defined below. JavaScript developers look to React Native and ReactJS for this type of development.

  • React Native

React Native serves the purpose of mobile app building well as it specifically supports the implementation of native features into hybrid apps. Though hybrid apps use web technologies, they can be launched from a mobile app platform without opening a web browser.

  • Virtual DOM

ReactJS is responsible for building user interfaces. It is often used for the base of mobile apps.

The document object model (DOM) is a chief component of ReactJS. Consider DOM as an API for HTML and XML documents, allowing the user to read and manipulate the content on a page.

Virtual DOM (VDOM) entrusts the cache to hold a virtual instance of the DOM in memory. VDOM works in place of DOM as a less intensive clone where developers can edit a single component of the DOM at a time.

Only the changes will be synced with the original DOM. In refusing to render the real DOM, VDOM solves the issue of building large applications where data changes often, speeding up operations as a whole.

  • Single-way data flow

Single-way data flow, alternatively called unidirectional data flow, is a feature of React.

This type of data flow refers to when data is transferred from one part of an application to the others in only one way.

Developers have better control of the flow of data with single-way data flow versus two-way data flow in which the values passed to a component are mutable.

Conclusion —

Taking webpages from disenchanted to engaging, JavaScript’s versatility suits both front-end and back-end development. Its object-oriented framework helps developers code with dynamic functions in mind, resulting in an interactive experience for any given user.

It is important to note that JavaScript has almost nothing to do with the programming language named Java. The similar name was inspired by marketing considerations rather than good judgment. When JavaScript was being introduced, the Java language was being heavily marketed and was gaining popularity. Someone thought it was a good idea to try to ride along on this success. Now its stuck with the name.

--

--

Niharika Dhanik
Niharika Dhanik

No responses yet