Interview Questions

Interview Questions?

Q. You might have a form created in your React App that user might try to close by closing the tab, reloading the page or close the browser directly without saving the data (or submitting the form). You might want to prompt the user in this case to alert them that there might be unsaved changes that might be lost.

How to do that in React ?

Answer @ https://inthetechpit.com/2020/05/19/prompt-user-with-beforeunload-on-browser-tab-close-react-app/

Q. You have a form…in one child component C1…you want to fetch only input type=”text” elements, in 2nd child component C2…you want to fetch only radio elements… in 3rd child component C3…you want to fetch only checkboxes elements.

How would you proceed on this ?

Guess

var result = [];
for(var i=0; i< 10; i++){
result.push(i);
}
console.log(result);
#[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];var result = [];
for(var i=0; i< 10; i++){
result.push(function(){
return i
});
}
console.log(result[1]());
#10var x = 20;
var y= 21;
delete x;
delete y;
console.log(window.x);
console.log(window.y);
#20
21
var fn = "A";
var fln = "B";
function getName(){
var fn = "C";
var fln = "D";
}
getName();
console.log(fn);
console.log(fln);
#
A
B

Problem Statement

Identify the pattern and output:

[‘A’,’B’,’C’,’D’]

1->A
4->D
5->AA

6->ab

7->ac
8 -> AD
9->BA
12->BD
13->CA

17-> aaaa

???? -> AAAB

— — — — — — — — — — —

Reverse a string without affecting special characters

Input => abc.de.f.g

Expected Output => gfe.dc.b.a

Input:   str = "a,b$c"
Output: str = "c,b$a"
Note that $ and , are not moved anywhere.
Only subsequence "abc" is reversed

Input: str = "Ab,c,de!$"
Output: str = "ed,c,bA!$"

Solution: https://www.geeksforgeeks.org/reverse-a-string-without-affecting-special-characters/

Observer Design Pattern vs pub-sub pattern

@ https://medium.com/easyread/difference-between-pub-sub-pattern-and-observable-pattern-d5ae3d81e6ce

difference between let and const

--

--

--

Experience with Front-end Technologies and MERN / MEAN Stack. Working on all Major UI Frameworks like React, Angular.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to use python for google search

Create Reusable Web Components in HTML

Mongoose

Block based WYSIWYG editor using Angular

Request management made easy with @zup-next libraries for react: Part 3.

React.Memo vs Memoize

Avatar selector Vue.js component

ES6 JavaScript Concept

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anil Kumar

Anil Kumar

Experience with Front-end Technologies and MERN / MEAN Stack. Working on all Major UI Frameworks like React, Angular.

More from Medium

devDependencies vs Dependencies in reactJS

How to Hire Node JS Developers: Under the Microscope

How to Hire Node JS Developers: Under the Microscope

Tips and Tricks for smooth development and improving the performance of the react application

Binary Tree And How to Search and Insert With Recursive Functions