frontend interview questions for freshers - Selected 🎊🤩💯

Pro Coder
17 Jul 202427:45

Summary

TLDRIn this interview transcript, Sha D from Pune discusses his background in Information Technology and his recent focus on web development. He covers his knowledge of HTML, CSS, JavaScript, React, and MongoDB. The conversation delves into technical details, such as semantic tags, the difference between tags and elements, and the use of flexbox in CSS. Sha also touches on JavaScript data types, DOM manipulation, and the benefits of using React for building interactive websites.

Takeaways

  • 😀 Sha D introduces himself as a recent graduate from WAN College of Engineering, Pune, with a degree in Information Technology.
  • 💻 Sha has been learning web development for the past four to five months, focusing on the M Stack.
  • 🖥️ He has knowledge of HTML, CSS, JavaScript, React for the frontend, and MongoDB, Node.js for the backend.
  • 📜 HTML is described as a markup language for structuring web pages, with semantic tags like article, footer, and header aiding in SEO.
  • 🔗 Tags and elements in HTML are distinguished, with tags being the start and end markers and elements including the content within those tags.
  • ⚙️ Attributes in HTML provide additional information about elements, and inline elements like span and image have different behaviors compared to block elements.
  • 🎨 CSS is defined with the concept of cascading, where styles are applied in a specific order, with specificity determining the priority of styles.
  • 📐 The CSS Box Model includes content, padding, border, and margin, with the box-sizing property affecting how these are calculated.
  • 💡 JavaScript is used for making web pages interactive, with various data types and methods like slice, splice, and map for array manipulation.
  • 🏗️ React is highlighted for its modular approach, reducing DOM manipulation and making code easier to manage and maintain through components and states.

Q & A

  • What technologies has Sha D. learned in web development?

    -Sha D. has learned HTML, CSS, JavaScript, React for the front end, and MongoDB and Node.js for the back end.

  • What are semantic tags in HTML?

    -Semantic tags describe their meaning to the browser and developer. Examples include <article>, <footer>, <header>, and <table>.

  • What is the difference between a tag and an element in HTML?

    -A tag is the opening or closing marker in HTML, while an element includes the tag and its content.

  • What are attributes in HTML?

    -Attributes provide additional information about an element and are included in the opening tag.

  • What is the difference between block-level and inline elements in HTML?

    -Block-level elements take up the full width of their parent container and always start on a new line, while inline elements take up only as much width as their content and can be within a line of text.

  • Can height and width be applied to inline elements in HTML?

    -Typically, height and width cannot be applied to inline elements, but replaced inline elements like <img> can have height and width set.

  • What is the CSS Box Model?

    -The CSS Box Model includes content, padding, border, and margin for each HTML element.

  • What is the default value of the box-sizing property in CSS?

    -The default value of the box-sizing property is 'content-box'.

  • What is the purpose of the map() method in JavaScript arrays?

    -The map() method is used to transform an array by applying a function to each of its elements, returning a new array with the transformed elements.

  • What is the concept of state in React?

    -State in React is a dynamic aspect of a component that keeps track of and changes with events, allowing the UI to update accordingly.

Outlines

00:00

😀 Introduction and Background

The interview begins with the candidate, Sha D, introducing themselves. They mention their hometown, Pune, and their educational background, having completed a Bachelor of Computer Engineering in Information Technology from the WAN College of Engineering Sangli in 2021. Sha is currently seeking employment and has been learning web development for the past four to five months, focusing on the MERN stack (MongoDB, Express.js, React, Node.js). The interview will primarily focus on front-end technologies such as HTML, CSS, JavaScript, and React.

05:04

🔍 Technical Discussion on HTML and CSS

The conversation delves into technical details about HTML and CSS. Sha explains HTML as a language for describing web page content and structure, and discusses semantic tags, which provide meaning to both developers and browsers, aiding in search engine optimization. The difference between tags and elements, as well as attributes, is clarified. Sha also discusses block and inline elements, highlighting the distinction between elements like div and span, and the ability to apply height and width to inline elements like images. The discussion touches on replaced and non-replaced inline elements, and the limitations of applying dimensions to inline elements.

10:06

🎨 Exploring CSS and Flexbox

The interview continues with a focus on CSS, where Sha defines CSS as Cascading Style Sheets and explains the concept of cascading, which involves the application of styles in a hierarchical order. Specificity in CSS is also discussed, highlighting how styles are prioritized based on selector specificity. Flexbox is introduced as a layout system in CSS, and Sha clarifies that when display: flex is applied to a container, its children automatically become block-level, allowing for height and width properties to be used. The Box Model in CSS is briefly mentioned, emphasizing the default box-sizing property value of content-box.

15:10

📚 JavaScript Fundamentals

Sha is asked about JavaScript, explaining its role in making web pages interactive and dynamic. The discussion covers data types in JavaScript, distinguishing between primitive and non-primitive types. The difference between let and var in variable declaration is explored, with an emphasis on scope and redeclaration. Sha also touches on the concepts of parameters and arguments in function definitions, and the map method in arrays. The conversation hints at the difference between slice and splice methods, though Sha admits to not being fully knowledgeable about splice.

20:11

🌐 Understanding Promises and DOM

The interview moves on to discuss promises in JavaScript, which Sha identifies as a solution to callback problems. Promises are described as objects that handle asynchronous operations. The concept of the Document Object Model (DOM) is introduced, explaining how it serves as a tree structure for HTML elements that JavaScript uses to manipulate elements on a web page. Sha admits to not being familiar with event bubbling and capturing, but the conversation shifts to React, where Sha explains the need for React over plain JavaScript, highlighting the efficiency in updating the DOM and the modular approach of components.

25:12

📚 Declarative vs Imperative Programming

Sha discusses the concept of state in JavaScript and React, explaining the difference between using normal variables and React state. The conversation explores the declarative approach in React, where the UI is automatically updated based on state changes, as opposed to the imperative approach in JavaScript, where developers need to manually update the DOM. Sha acknowledges the efficiency of React in reducing DOM manipulation and the ease of managing code with its declarative nature. The interview concludes with Sha reflecting on their performance, noting that this was their first interview and expressing gratitude for the opportunity.

Mindmap

Keywords

💡HTML

HTML, or Hypertext Markup Language, is the standard language for creating web pages. It describes the structure of a web page using tags. In the script, the interviewee discusses HTML's role in defining content and structure, highlighting its fundamental importance in web development.

💡Semantic Tags

Semantic tags in HTML provide meaning to both the browser and the developer about the content enclosed within them. Examples include <article>, <footer>, and <header>. They improve code readability and SEO. In the script, semantic tags are discussed in relation to their roles in describing content and aiding search engine optimization.

💡CSS

CSS, or Cascading Style Sheets, is a style sheet language used for describing the presentation of a document written in HTML. It controls the layout and appearance of web pages. The script addresses CSS in terms of its cascading nature and its role in defining visual aspects like width and border radius.

💡Flexbox

Flexbox is a CSS layout model that provides an efficient way to lay out, align, and distribute space among items in a container. It makes responsive design easier. In the script, Flexbox is mentioned in the context of defining layouts and how it impacts child elements within a flex container.

💡JavaScript

JavaScript is a programming language used to create dynamic and interactive effects within web browsers. It enhances user experience by enabling features like form validation, content updates, and animations. The script explores JavaScript's necessity for interactivity and different aspects like data types, variables, and promises.

💡React

React is a JavaScript library for building user interfaces, especially single-page applications. It allows developers to create reusable UI components. The script explains React's modular approach, its efficiency with the virtual DOM, and how it simplifies state management compared to vanilla JavaScript.

💡State

In React, state refers to a built-in object used to hold data or information about the component's current situation. State changes trigger UI updates. The script discusses how React's state management differs from using plain variables in JavaScript and its importance in maintaining dynamic aspects of components.

💡Promises

Promises in JavaScript represent the eventual completion (or failure) of an asynchronous operation and its resulting value. They help manage asynchronous code more efficiently. In the script, promises are mentioned as a solution to callback hell, providing a clearer and more manageable way to handle asynchronous operations.

💡DOM

The DOM, or Document Object Model, is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content. The script describes the DOM as a tree-like structure manipulated by JavaScript to dynamically update HTML content.

💡Virtual DOM

The virtual DOM is a lightweight copy of the actual DOM used by React to improve performance. It updates the real DOM only where changes have occurred. The script touches on how React uses the virtual DOM to efficiently manage UI updates, minimizing direct manipulation of the actual DOM.

Highlights

Introduction of the candidate, Sha D from Pune, with a B.Tech in Information Technology completed in 2021.

Sha has been learning web development for the past four to five months, focusing on the MERN stack.

Sha's expertise includes HTML, CSS, JavaScript, React for front-end, and MongoDB and Node.js for the back-end.

Explanation of HTML as a Hypertext Markup Language used for describing the content and structure of web pages.

Discussion on semantic tags in HTML and their role in providing meaning to browsers and developers, aiding in search engine optimization.

Difference between tags and elements in HTML, with tags being the start and end points and elements including the content.

Attributes in HTML provide additional information about elements, included in the opening tag.

Block-level elements (div) versus inline elements (span), including examples and characteristics.

Explanation of cascading in CSS, referring to the order and priority in which styles are applied.

Specificity in CSS determines the priority of styles applied to elements, affecting the final rendered style.

Difference between position relative and position absolute in CSS, with relative positioning based on the element's normal static position and absolute positioning relative to its ancestor element.

Flexbox layout system in CSS used for defining the layout of web pages and how display: flex affects child elements.

Explanation of the CSS box model, including content, padding, border, and margin, and the difference between content-box and border-box.

JavaScript makes web pages interactive and dynamic, with different data types and methods for creating variables (var, let, const).

Importance of React in building modular and maintainable applications, reducing DOM manipulation through a declarative approach.

Transcripts

play00:00

hi sha how are

play00:01

you yes sir I am fine sir okay just

play00:05

introduce yourself then we'll move to

play00:07

the

play00:08

questions yes sir thanks for giving me

play00:11

the opportunity sir uh my name is sha D

play00:14

and I am from Pune I have done my bch in

play00:18

uh information technology in

play00:21

2021 and uh from the WAN College of

play00:24

Engineering sangi and uh currently I'm

play00:28

looking for job

play00:30

okay yeah so how long have you been

play00:34

learning web

play00:36

development uh from past four five

play00:39

months I I have been working on web

play00:43

development what are all the

play00:44

Technologies you have learned so

play00:47

far I'm working on the M Stack so I have

play00:52

learned HTML CSS JavaScript react in the

play00:55

front end and uh some of the back end

play00:58

like mongod DB and not J okay so this

play01:02

interview is for front end so we'll

play01:04

mainly focus on HTML CSS JavaScript and

play01:09

react okay yes

play01:11

sir so let's

play01:13

start can you tell me what is what is

play01:19

HTML HTML is hypertext markup language

play01:24

language which is uh basically used for

play01:26

describing the content and the structure

play01:28

of a web page

play01:30

okay what are semantic tags in

play01:34

HTML what sir semantic tags uh semantic

play01:39

tags are like which mean uh describe its

play01:43

meaning to the browser or for the

play01:46

developer for example uh table tag it uh

play01:50

shows its meaning these are like santic

play01:54

T can you give me four examples apart

play01:58

from table

play02:00

uh table article then footer header yeah

play02:04

that's these are yes okay so apart from

play02:08

providing meaning to the developer and

play02:11

browser does it help in any other

play02:16

way in um search engine optimization

play02:20

also it helps yeah that's

play02:23

correct okay so what is difference

play02:26

between tag and uh element in HTML

play02:32

uh element is uh tag with its content

play02:35

included uh tag is just the starting and

play02:39

the uh hand tag and the contain with

play02:43

contain it is called the

play02:45

element okay what are

play02:49

attributes in attributes uh attributes

play02:52

provides additional information about

play02:55

the uh element or the tax and they are

play02:59

included in in the start uh starting

play03:01

time okay yeah it is not a starting time

play03:06

it is opening time yeah yes open yeah

play03:11

what is difference between D and

play03:14

span uh d uh D is a block level element

play03:18

and span is a inline element so block

play03:22

takes the full width of

play03:24

the mean whatever the parent it is in

play03:28

and in line is take the width of the

play03:31

content

play03:32

that yes can you give me some examples

play03:35

ofine elements 2 3 4 five

play03:38

examples in line uh for example uh span

play03:43

tag uh then image tag okay and

play03:53

another I can't I know what I can okay

play03:56

no problem apart from this width

play04:00

difference is there any other difference

play04:03

like block has complete width of its

play04:06

parent and inline has width of its

play04:09

content inside it so is there any other

play04:14

difference block elements always start

play04:17

on the new line yeah in line are always

play04:22

mean they can be inside a text or

play04:25

anything okay so can we give height and

play04:28

width on inline elements

play04:32

uh height and with no we cannot okay but

play04:37

on image tag we can give height and

play04:43

width what sir on image tag image is an

play04:47

inline element

play04:48

right yes sir and we can give height and

play04:52

width on Element

play04:54

image

play04:55

right oh yes yes how is it possible

play05:03

so image itself has its own attributes

play05:06

like width and

play05:09

he yeah even if we give using

play05:13

CSS it works like it is in line but how

play05:16

height and with

play05:20

Works sorry sir I can't I don't okay so

play05:24

basically in line elements are of two

play05:26

types one is replaced in line another is

play05:30

non- repaced in line so replaced in line

play05:34

means those Elements which come through

play05:37

some URL for example image comes through

play05:39

some URL okay yes video tag is also in

play05:42

line but it comes through an URL same is

play05:45

the case with iframe so those elements

play05:48

inline Elements which came through or

play05:51

are loaded through an URL those are

play05:54

called replaced inline elements and on

play05:57

replace element in line elements we can

play05:59

give height

play06:00

width okay thanks I didn't know this yes

play06:06

okay now do you know difference between

play06:08

canvases and SVG in element uh in

play06:15

HTML so I just know that they are used

play06:18

in

play06:19

graphics

play06:21

yes okay difference you don't right oh

play06:25

no I haven't used it okay no problem

play06:30

uh let's move to CSS can you uh tell me

play06:34

what is full form of

play06:36

CSS uh cascading style shets okay can

play06:40

you tell me the meaning of first word in

play06:42

the full

play06:46

form

play06:48

Cascade full form sir full form is

play06:51

cascading

play06:53

stylesheet what does it mean by uh

play06:57

cascading cascading uh means in CSS it

play07:01

means that how the styles are applied to

play07:04

the

play07:06

elements Suppose there are parent

play07:09

element and a child element so if we

play07:12

apply style to the parent it will also

play07:15

apply to the child but if unless until

play07:18

we specify some specific style to the

play07:21

child element so uh it is the process in

play07:25

which it is applied Styles or the

play07:28

priority which is given to

play07:30

the okay you said if if we give some

play07:34

Style on parent it will be applied to

play07:36

the child

play07:38

also yes let's say we give width on

play07:42

parent 500

play07:44

pixel will it be applied on the child

play07:49

also or if we give border

play07:56

radius uh no sir but uh cascading is

play08:00

like the priority which is given to the

play08:04

Styles okay in which uh order are the

play08:08

styles are

play08:09

applied yeah that is that is correct

play08:13

that is better like cascading does not

play08:15

have any relation with the

play08:17

parent it is it is the order like in

play08:21

which order the C is being applied so

play08:25

there is one Cascade rule in CSS that

play08:28

whichever style will come below that

play08:30

will be applied like below Styles will

play08:32

override the Styles above if yes uh like

play08:36

they conflict each other okay and what

play08:40

is a

play08:43

specificity specificity is like the

play08:47

priority which is given to the selectors

play08:51

which selector have a higher specificity

play08:54

they are applied uh that styles are

play08:57

applied first and uh if means there are

play09:00

same um element have two um

play09:05

selectors yes and which selectors are

play09:09

given higher priority okay yeah that's

play09:13

correct now can you tell me what is

play09:16

default value of position

play09:19

property position property has a default

play09:22

value of

play09:23

stattic

play09:25

okay yeah that's correct now what is

play09:28

difference between position relative and

play09:31

position

play09:34

absolute relative position uh is

play09:38

relative to its the uh normal uh static

play09:44

static position and absolute is um

play09:48

position according to the

play09:50

ancestor element

play09:53

there it takes

play09:57

yes okay

play10:00

yeah like you're

play10:02

close it's good now let's move to our

play10:06

next question what is

play10:10

flexbox uh flexbox is a layout um system

play10:14

that we use in

play10:16

CSS uh for u mean defining the layout of

play10:20

a web page yeah that's true now there is

play10:25

one question I have if let's say we have

play10:28

one container D on which we give display

play10:33

flex and inside the container we have

play10:35

two

play10:36

spans Span in Span one it is written

play10:40

hello in Span 2 it is written

play10:43

world so if we give height and width to

play10:47

a span will it

play10:50

work yes

play10:52

sir okay but span is an inline element

play10:57

should not work

play11:00

why will

play11:06

work sorry sir

play11:09

I okay so basically it will work so

play11:14

whenever we give display Flex on the

play11:16

parent all of its Childs automatically

play11:19

become display

play11:22

block okay so even if we use any even if

play11:26

you just go and give display in line

play11:28

that will not be taken it will be

play11:31

rejected like it will be overwritten and

play11:34

automatically it will become display

play11:36

block if parent has display Flex okay

play11:40

okay so that's why any element if we put

play11:44

inside Flex box we can give height and

play11:47

width okay

play11:49

okay okay

play11:52

uh what is Box model in

play11:57

CSS uh Box model model is uh which

play12:01

suppose uh every element in HTML have

play12:05

some uh it includes like content then

play12:09

padding border and the margin so this uh

play12:13

every element has all these four things

play12:15

so

play12:16

incl this is called the Box model Box

play12:19

model okay there is one property called

play12:23

box sizing border

play12:26

box so yes sir do you know what is the

play12:29

default value of box

play12:31

sizing uh it's content box okay so why

play12:37

do we give what happens what is

play12:39

difference between content box and box

play12:41

uh border

play12:43

box uh in content box uh when we

play12:46

calculate the total width uh the padding

play12:49

and the margin are are included with its

play12:52

content also is the total WID it's

play12:55

calculated with the including its uh

play12:58

padding and marging border so with with

play13:01

content box uh uh with border box uh in

play13:06

the whole

play13:07

WID the means the whole WID is

play13:11

calculated uh including

play13:15

the I

play13:20

think yeah you you're going in the right

play13:24

direction but it is not 100% correct

play13:36

sorry sir

play13:38

I you

play13:41

forgot mean I in Border box we don't

play13:45

include the total um in the total width

play13:49

of the content we include the pading and

play13:53

margin we don't calculate it separately

play13:57

me okay

play13:59

basically you are saying the other way

play14:01

around whatever you are saying the for

play14:04

box border box that is for Content box

play14:09

okay so and margin and padding is not

play14:15

calculated here margin and Border we we

play14:19

should say margin and Border uh sorry

play14:21

sorry padding and Border okay margin is

play14:25

outside

play14:27

so uh yeah that is that is fair that is

play14:32

good now let's move to

play14:34

JavaScript so can tell me different data

play14:39

types first uh before going to that

play14:42

question can you tell me why do we need

play14:44

JavaScript for making

play14:47

websites so JavaScript makes the web

play14:50

pages uh

play14:51

interactive okay that is for dyam

play14:55

dynamic content we

play14:58

can okay so what are different data

play15:02

types in

play15:03

JavaScript uh in JavaScript there are

play15:05

eight data types seven of them are non-

play15:09

primitive and primitive and the other

play15:13

one is non- primitive uh like number uh

play15:17

then

play15:18

string

play15:20

uh then uh symbol big in undefined

play15:27

null and object is um non

play15:31

primitive yes that's true so why do we

play15:33

have these two

play15:35

categories what is

play15:38

difference non Primitives are uh mean we

play15:42

cannot directly uh have

play15:45

a we have a reference to that object we

play15:49

cannot directly change that values

play15:52

that's

play15:54

why yeah like partially

play15:57

correct okay

play16:01

now what like what in how many ways we

play16:05

can create variable in

play16:08

JavaScript three ways using V late and

play16:14

const yeah so what is difference between

play16:18

let and

play16:20

where so where uh where where using

play16:24

where we can redeclare the variable and

play16:27

it has a like a Glo Global scope if we

play16:31

use it

play16:32

outside okay

play16:35

and late we cannot redeclare it but we

play16:39

can reinitialize its value but we cannot

play16:41

redeclare it and what about the scope of

play16:45

L uh L is a block scope L has a block

play16:50

scope okay this is correct like for let

play16:55

that is block scope this is correct but

play16:58

V is not a glob scope

play17:00

variable what is a function scope

play17:03

variable oh okay sir

play17:07

okay

play17:08

[Music]

play17:10

so what is difference between par

play17:13

parameter and

play17:17

argument yes sir uh in parameters are

play17:21

passed at the time of function

play17:23

definition when we are writing function

play17:26

definition at that time uh parameter are

play17:29

passed and arguments are the actual

play17:31

value that we pass when we call the

play17:34

function okay yeah that's true now what

play17:39

is difference between slice and splice

play17:41

method array

play17:44

method slice slice is uh used to means

play17:49

Suppose there is string and that slice

play17:53

used to we have to give two arguments in

play17:57

that the start and the end and

play18:00

uh index okay for AR I'm asking are you

play18:04

are you telling for

play18:07

string it will I think it will work the

play18:10

same way uh for AR like for string it

play18:15

is little

play18:17

different okay I think splice method

play18:21

splice method is not present on a

play18:26

stram okay slce is there

play18:31

to um

play18:42

take hello one second your voice is

play18:44

breaking let me check

play19:00

hello hello yes your voice was breaking

play19:03

I think there was some issue in my

play19:05

internet okay yeah so slice and

play19:10

disce for array

play19:14

methods splice uh is U we want to take

play19:19

um element means we want to bring

play19:21

elements from uh array we have to

play19:25

mention the start index and the uh end

play19:28

index

play19:29

and from that we can take I'm not sure

play19:34

about the splice method sir

play19:37

okay

play19:40

okay so you know about map

play19:45

method yes sir map uh why do we use map

play19:48

method in

play19:50

AR uh when we want to transform and

play19:54

array uh we use map

play19:57

method yeah yeah that's

play20:00

true now let's move to okay uh first

play20:04

tell me what are promises in

play20:08

JavaScript promises uh promise is like

play20:11

object and uh it is used uh

play20:15

for it's a solution to the problem that

play20:19

we have with the call back call back

play20:22

help problem so we for that we use

play20:25

promises because it's like object

play20:30

it uh returns a

play20:32

promise

play20:36

okay how much experience do you

play20:40

have no sir I'm a fresher okay you're

play20:45

answering very well that's why I thought

play20:47

you have some

play20:48

experience yes I have

play20:51

inter so I'm looking for a job so that's

play20:55

why okay so so far far is good let's see

play21:00

how it goes what is uh

play21:04

Dom Dom is like uh Tom is a tree like

play21:09

structure that is

play21:11

uh is made by the browser mean it is

play21:15

used for

play21:17

uh mean JavaScript uses Dom uh HTML

play21:23

elements to manipulate the elements in

play21:27

the HTML

play21:29

yes that's true

play21:32

now like you know event bubling and

play21:36

event

play21:39

capturing uh no sir okay no

play21:42

problem now let's move to react can you

play21:47

tell me why do we need react why can't

play21:49

we build everything using

play21:53

JavaScript yes sir uh because uh with

play21:57

JavaScript you have to select every

play22:00

element multiple times so it makes mean

play22:03

after when there is Big application it

play22:06

becomes very difficult to manage that um

play22:09

and maintain that code with react react

play22:11

has a modular approach means

play22:14

uh you can create uh components and it

play22:18

becomes very easy to manage uh

play22:21

every part of the

play22:23

code

play22:25

okay okay so basically the problem in

play22:28

JavaScript is we have to select multiple

play22:30

times right yes sir okay any other like

play22:35

only if the problem of selecting yeah no

play22:41

sir also with the react there is

play22:45

a react is very efficient in updating

play22:49

the Dom it it doesn't uh reflect um

play22:54

immediately change the Dom it has a

play22:57

virtual Dom which mean

play22:59

first it updates the virtual Dom and

play23:02

then only the updated part is updated in

play23:05

the actual

play23:06

Dom yeah but

play23:11

JavaScript but in JavaScript also we

play23:14

update only the part which we need if

play23:16

you don't update everything on the page

play23:19

let's say if you make a counter app you

play23:22

will update the inner text of that

play23:24

counter element right you will not

play23:27

update

play23:30

everything so yes sir JavaScript also

play23:35

that is also

play23:37

efficient so it reduces the Dom

play23:41

manipulation yeah that's that's correct

play23:45

yeah that's

play23:47

correct so basically we don't have to

play23:50

manipulate the term and react it like

play23:54

whenever we make react we don't even

play23:56

write a single line of code to

play23:57

manipulate on right yeah yes sir so

play24:03

basically the react is a declarative

play24:06

approach of

play24:07

programming and JavaScript if we make

play24:11

JavaScript project that is imperative

play24:14

approach of making applications do you

play24:17

know these things declarative and

play24:20

imperative uh yes sir I have

play24:23

read

play24:25

yes can you tell me what is difference

play24:28

with imperative and

play24:32

declarative I don't know exactly

play24:34

declarative means we uh it's the code

play24:37

becomes very easy to manage uh yeah

play24:42

that's true that's true but that is not

play24:46

the exact difference

play24:48

between uh declarative and imperative

play24:51

basically uh declarative means that we

play24:57

tell our comp component or our

play24:59

application that this is our state I

play25:02

will update the state I don't care about

play25:05

the UI UI will automatically be updated

play25:08

okay okay but in imperative way of

play25:11

programming means there will be some

play25:14

variable we will create or there will be

play25:16

some state that will will create in

play25:18

JavaScript in JavaScript there is no

play25:20

concept of state but we can call our

play25:23

normal variables as a state and if we

play25:26

update the variable we have to update up

play25:28

the Dom again every time we update the

play25:30

variable we need to update the Dom so we

play25:33

need to tell do this and then do that so

play25:37

the code becomes double almost double

play25:40

one is for increasing the variable one

play25:42

is for updating the Dom that updated

play25:44

value to the Dom so if we can do

play25:48

something uh if we do do something in

play25:50

JavaScript in 100 lines the same thing

play25:52

can be done in react in 50

play25:55

lines yes sir because of narative

play25:58

approach it reduces the Dom manipulation

play26:02

part from

play26:03

JavaScript yeah so that is difference

play26:07

between imperative and

play26:09

declarative what is concept of a state

play26:12

in JavaScript uh in

play26:15

reala yes sir uh state is like mean it's

play26:19

like a dynamic aspect of a component of

play26:22

or a variable that we we want to keep

play26:25

track of and change with the some event

play26:28

or something

play26:31

like

play26:33

okay

play26:34

now why don't we use normal variables

play26:37

why do we use react uh react

play26:42

State

play26:45

um can't we change a variable yeah say

play26:49

uh in react we cannot directly uh mean

play26:52

uh update that variable with the with a

play26:56

event so we have to use um the state

play27:01

like we have to use hooks for that what

play27:04

if we update a variable directly and use

play27:06

it on what will happen okay any other

play27:10

question thank

play27:11

you this was my first interview so Mo

play27:15

interview okay this was your first

play27:17

interview of any

play27:19

kind yes sir and then you perform very

play27:22

well

play27:24

actually yes sir

play27:28

and there can be Improvement but

play27:30

considering first interview as a fresher

play27:32

is very

play27:34

good okay yes sir okay any other

play27:38

question uh no sir no sir thank you sir

play27:42

okay okay bye sh okay

Rate This

5.0 / 5 (0 votes)

相关标签
Front-end InterviewWeb DevelopmentHTML BasicsCSS FlexboxJavaScript Data TypesReact StateDOM ManipulationInterview ExperienceCareer GrowthTechnical Skills
您是否需要英文摘要?