Get me outta here!

Sunday, August 28, 2022

What is JavaScript, NodeJs, ReactJs, TypeScript?

 

What is Java
Script?

JavaScript is a very powerful client-side scripting language(will discuss later). JavaScript is used mainly for enhancing the interaction of a user with the webpage(page opened in the browser). In other words, you can make your webpage more lively and interactive, with the help of JavaScript.

JavaScript was developed by Brendan Eich in 1995, which appeared in Netscape, a popular browser of that time. The language was initially called LiveScript and was later renamed JavaScript.

In simple words,

JavaScript was initially created to “make web pages alive”.

When people say “JavaScript is a very powerful client-side scripting language”, again you will wonder about, now what the heck is this Scripting language? Why we call some languages as “Core programing language” & some language as “Scripting language”? Don’t worry let me explain it to you.

Credits: Unplash

Language vs Script

So if you are new in the development profile you used to listen to these keywords very frequently. In one way all the scripting languages are programming languages, The theoretical difference between the two is that scripting languages do not require the compilation setup and are rather interpreted at run time like PHP & JavaScript. However, Language requires a full compilation environment to first compile the code and then run the code as we did in colleges and schools with Java & C. If you got the point you can move to the next heading but if you are still confused let's see this example.

Example 1:
In “C” (language), The C compilation process starts with the source code as input and converts the source code into machine-readable code. The process can be broken down into four steps: Preprocessing, Compiling, Assembling, and Linking.
Whereas in PHP/JavaScript(Scripts) interpreters read the code and execute in real-time rather than making a machine-readable code of the code first.

An interpreter produces a result from a program(Script), while a compiler produces a program(language) written in assembly language. :- Knowledge base, Indiana Univeristy

Language vs Framework

At the start of the college, Coding is quite simple, we have libraries(stdio.h, if you used C in college), variables, for loops, if conditions, functions, etc. But as we start developing more we introduced to the new keyword “Framework”.
What is this Framework? Don't we already have so much to understand and learn that this new terminology also introduced to create confusion? Let’s understand this by an example first.

Everybody knows about Hindi & Devanagiri correct? So as we know Devanagiri is a lipi to write Hindi & some other languages. Devanagiri defines the set of rules and the manner of writing in which Hindi is written. While In Hindi we have pre-defined keywords(made by Hindi alphabets अ आ इ ई उ ऊ) to use by which we communicate.

The same thing applied in language & framework also, A language is just a minimal set of rules for doing things like “Devanagiri”. Whereas the framework is a collection of useful tools written for a particular programming language as we discuss in the above example “Hindi”. So JavaScript is a language but Angular is a framework, JavaScript provides a minimal set of rules for coding and system tools to compile it whereas Angular provides a collection of useful tools to make coding easy and organized.

A software framework (be it front-end or backend) includes standardized, pre-written code, which makes the development of certain functionalities easier and faster. You have less freedom to code, as you have to code as the framework architecture dictates. :- DZone.com

I hope, now you got the difference between framework, Language & Scripts. Let’s come back on the topic for which you are here. JavaScript!

Credits: Codemagic blog

What JavaScript can do?

What is the purpose of reading JavaScript, what is the scope of JavaScript, is it really helpful if you want to pursue your career in this language? Let's check it out.
Basics

  • JavaScript can add new HTML to the page, change the existing content, modify styles.
  • JavaScript React to user actions, run on mouse clicks, pointer movements, key presses.
  • Send requests over the network to remote servers, which are called APIs.
  • Get and set cookies, ask questions to the visitor, show messages.
  • Remember the data on the client-side(store data in the browser’s local storage).

When you visit some websites and a popup appears from nowhere asking to subscribe to the website. JavaScript is at work.

Advance

  • JavaScript used to create server APIs.
  • JavaScript used to interact with the database.
  • We can make cross-platform mobile apps(both IOS/Android) in JavaScript.
  • JavaScript used to make desktop applications as well as a gaming platform.

So it’s like JavaScript can do anything, whatever you want whenever you want JavaScript has a solution for the same.

How did JavaScript run?

In the early days of JavaScript, it was executed only in the browser, but with the enhancement in the language now we can run JavaScript also on the browser, server, mobile apps, or actually on any device that has a special program called the JavaScript engine. With the help of a JavaScript engine, we can run JavaScript anywhere.

— — — — — — — — — — -For extra knowledge — — — — — — — — — —
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.
- “Trident” and “Chakra” for different versions of IE.
- “ChakraCore” for Microsoft Edge.
- “SquirrelFish” for Safari.

So now you know what is JavaScript? What are its applications? How does it run and what is the difference between language/scripts/frameworks? Now when you google “JavaScript” on the internet or talk with some JavaScript developer, he will tell you I am a node developer or I am an angular developer or some kind of full stack developer. Again your mind gets confused now JavaScript is cool but what are these things everyone discussing about. No need to worry we are going to understand the same.

Heck between NodeJS, AngularJS, ReactJS & Typescript

Credits: Guru99

All these keywords(note: not saying language) include “JS” as the suffix, what is mean by that. Is it all some kind of language extracted from JavaScript or totally different like Java(Language) & JavaScript(Script).

NodeJS & AngularJS are the frameworks(already explained above) of JavaScript. Some people say “NodeJS is JavaScript run time”. For now it’s simply a framework for you. We will learn about this in upcoming tutorials. is Now let’s see how these two main frameworks are useful. I already told you JavaScript runs on the server-side(Back-end) as well as on the client-side(front-end, on the browser). So to implement JavaScript on the server(back-end) we use the NodeJS framework and to implement JavaScript on the client-side(front-end) we have AngularJS framework.

Simply put, Node JS is a back-end development framework, while Angular is a front-end development framework.:- Quora

Credits: ValueCoders

Other than these two frameworks ReactJS is a simple library. A library is a collection of functions and functionalities, which you can use to achieve your functionalities & requirements. For a better understanding of the library recall your starting days of coding in C when we need to use <stdio.h> for input/output operations & <math.h> for mathematical operation. So unlike Node & Angular, React is not a framework of JavaScript but a simple library that we can include in the existing code anytime(Click here) and use it predefined functions and other benefits to make our coding faster and easier. We can make the project in the React from scratch also. The basic difference between Library & Framework is…

Our code calls the library while the framework calls your code.

Frameworks are fine(Node/Angular), Libraries are fine(React) but what is TypeScript? TypeScript can be explained as a superset of JavaScript. It means that every JavaScript code is valid Typescript code, but Typescript comes with some additional features which JavaScript don’t have:
Strong-typed variables: We can define a variable’s type with the strong-typing feature like we define a variable in Java or C++. Strong typing means once variable type declared it can’t be changed or manipulated.
Object-oriented programming: We are able to write object-oriented code with Typescript whereas in JavaScript you will not(till ES5).

 If you are a newbie to JavaScript don’t worry about TypeScript for now because there is a whole sea of knowledge in JavaScript itself, For now, you can focus on JavaScript, Node, Angular, React and then you will get the point and use of TypeScript.

Reference: Singh, P., 2022. What are the differences between JavaScript, Node, TypeScript, Angular and React?. [online] Medium. Available at: <https://javascript.plainenglish.io/noobies-exploration-to-javascript-part-1-introduction-to-js-diff-b-w-93c8cc062fa8> [Accessed 28 August 2022].

0 comments:

Post a Comment