10 most important basic interview questions for React & JavaScript

1. React Hooks
Hooks are a kind of function of React. It may give return or not. There are two main hooks, they are given bellow.
i. useState()
ii. useEffect()
useState:
useState is a hook which can take optional parameter as like object and array type value.
useEffect:
useEffect is also a hook which can take a callback function and a dependency. The dependency can be use one or more elements.
2. Accessibility of React
React also conscious about the disability persons (hard in hear, dumb, blind, cognitive). For them react has created some technique so that they also can use a react application.
Some techniques are given bellow:
i. Semantic Tags
ii. Focus and Keyboard
iii. Screen Reader
To apply this techniques a developer should follow some guidelines to implementation in coding.
3. Some true-false returning state in JavaScript for using string
False value returns:
i. any number
ii. “”
iii. undefined
iv. null
v. NaN
True value returns:
i. “ empty string”
ii. “any numbers”
iii. [ ]
4. Undefined Vs. Null in JavaScript
Undefined:
In one sentence we can say, the undefined is that value which is not fund. There are many types of way to get undefined value.
Some of ways are given bellow:
i. By declaration.
Example:
let age = undefined;
console.log(age);
Result: undefined
ii. Undefined value in an array or object but that is not there.
Example of an Array:
let name = [modu, kodu, bodu]
console.log(name[3]);
Result: undefined
iii. Undefined value in function.
Example 1:
const add = (n1, n2) => {
console.log(n1, n2);
}
const total = add( 2, 5 );
console.log(total);
Result:
2 5
undefined
Example 2:
function add(n1, n2, n3){
}
const total = add( 2, 5 );
console.log(total);
Result:
Undefined
5. Double equal (==) Vs. Triple equal (===)
In one sentence we can say, Double equal checks only ‘value’ but Triple equal checks ‘value’ and ’type’.
Example for double equal:
const num1 = 5;
const num2 = ‘5’;
if(num1 == num2){
console.log(“Numbers are equal”);
}
else{
console.log(“Numbers are not equal”);
}
Result:
Numbers are equal
Example of triple equal:
const num1 = 7;
const num2 = ‘7’;
if(num1 === num2){
console.log(“Numbers are equal”);
}
else{
console.log(“Numbers are not equal”);
}
Result:
Numbers are not equal
6. Map, Filter, Find applying on an array in JavaScript:
Map, Filter, Find are functions of JavaScript.
Map:
Map is one kind of looping function. It works on array to display them according to criteria of coding.
Filter:
Filter is also a looping function. But it works on condition under Mapping or Array.
Find:
Find is used to find a specific thing via condition.
7. Call in JavaScript
Call is defined as, A created method which is using in an operation but that method is also need to use another operation. For this, the method is using in another operation without repeating that method.
8. Window of JavaScript
In a sentence we can say about window, window is a field where a JavaScript code runs on. Window contains the keywords of JavaScript (console, document, document.getElementById, document.getElementByClass, document.getElementByClassName, etc)
9. Global Variable
A Global variable is a declared variable which is used for all parts of a code. Global variable is accessible from anywhere.
10. Local Scope
A Local variable is a declared variable which is used for only a part of a code. Local variable is not accessible from anywhere. The place of Local variable is called by Local Scope.