Introduction
This article will try to cover all the JavaScript prerequisites that we need to learn about ReactJS.
It will cover the following topics
- Definition
- Implementation - Difference between let and var
- Implementation - Constants in ECMA
- Implementation - Concatenation of string
- Implementation – Concept of Class
- Implementation - Inheritance
- Implementation - Objects are Mutable
- Implementation - Objects are Immutable
- Implementation - Spread operator and arrow operator
What is JavaScript?
- It’s the programming language for the web.
- It can update and change both, HTML and CSS.
- It can calculate, manipulate, and validate the data.
Implementation– Difference between let and var
The major difference between let and var is that “let value does not reflect after the block but var value can”.
Examples
VAR
- var a = 10;
- console.log(a);
- if (a) {
- var a = 20;
- console.log(a);
- }
- console.log(a);
Output
- 10
- 20
- 20
LET
- let a = 10;
- console.log(a);
- if (a) {
- let a = 20;
- console.log(a);
- }
- console.log(a);
Output
- 10
- 20
- 10
Implementation– Constants in ECMA
It is something whose value can’t be changed.
Examples
- const a=10;
- a=20; //compile error
Implementation – Concatenation of string
Here, we will see how we can combine two strings using old JavaScript and the new ECMA way.
Examples
OLD WAY
- var a="Hi";
- var b="Gourav";
- console.log (a+" "+b);
Output
- Hi Gourav
NEW WAY
- var a="Hi";
- var b="Gourav";
- console.log(`${a} ${b}`);
Output
- Hi Gourav
Implementation– Concept of Class
Here, we will see how we can combine two strings using old JavaScript and the new ECMA way.
Examples
OLD WAY
- var a="Hi";
- var b="Gourav";
- console.log (a+" "+b);
Output
- Hi Gourav
NEW WAY
- var a="Hi";
- var b="Gourav";
- console.log(`${a} ${b}`);
Output
- Hi Gourav
Implementation– Inheritance
Here, we will see how inheritance works in ECMA script using the concept of classes.
Example

Join the conversation! Your thoughts help the community grow.