Important questions asked in REACT JS Interview.

What are CSS Modules and why do we use them?

Difference between stateful and stateless components?

Difference between props and state?

What is a Pure Component and what are its limitations?

--

--

JavaScript objects are containers for named values called properties or methods. Key-Value Pair.

Objects are variables too. But objects can contain many values.

This code assigns many values (Fiat, 500, white) to a variable named car:

var car = {type:”Fiat”, model:”500", color:”white”};

car.type = ‘Fiat’

car.values=[‘Fiat’, ‘500’, ‘white’]

car.keys=[‘type’, ‘model’, ‘color’]

Function —

To create a function we use the keyword function

--

--

Type coercion is the automatic or implicit conversion of values from one data type to another (such as strings to numbers).

Type conversion is similar to type coercion because they both convert values from one data type to another with one key difference — type coercion is implicit whereas type conversion can be either implicit or explicit.

Coercion and types —

Type Coercion is the conversion of a value from one data type to another data type.

This can be done either programmatically by us or automatically by Javascript.

This results in two types of coercion.

Implicit Coercion — Implicit Type Coercion is done automatically by Javascript. //console.log(10+ ‘books’)

Explicit Coercion — Explicit Type Coercion is done programmatically by us. //console.log(var.toString()) console.log(typeof(String(true))) console.log(typeof(Number(true))) console.log(typeof(Boolean(45)))

--

--

If Else, Switch, control statements, etc.

If Else Structure —

if(this condition is true){ print this}

else{print this}

Switch Case —

We use a switch when based on certain known values we need to perform certain tasks.

switch(value){

case a:

console.log(‘a’)

break;

case :

console.log(‘b’)

break;

case c:

console.log(‘c’)

break;

default:

console.log(‘wrong’)

--

--