Difference between null and undefined?
Ans: If we do not assign any value in the variable, array, or object but we want to access this variable we get an undefined output. Suppose, var a;
Null is explicitly assigned to the variable. It is also an empty or non-existent value.
Difference between == and === ?
Double equal basically checks the value of the checking elements. If the type is not the same they convert a similar type for all. But in triple equal, it can check value and type.
const a = 5
// output true
// output false
What is a closure?
If we call a function inside another function, it will create a close environment. The function which returns from the main function can access any value. That is declaring outside of this function. If we call the main function with several variables we get several outputs that look like close surfaces.
What are the global scope and global variables?
Global scope means accessible from anywhere. Suppose a variable declared outside of a function. We can call this is a global scope because we can access this variable from anywhere and this variable is called a global variable. If a var declared inside the function, it can also access outside the function.
Rule of ‘this’ keyword?
Basically, It depends on which context is function or method called. If we apply it to the object we can see the left side before the dot. And find this value. If there is nothing in before dot this value will be a window. If we apply it to any element, then this value will be an element.
Find the largest element of an array?
const fullArray = [200,300,120,2390,50]
let maximum = fullArray
const newElement = fullArray[i]
console.log(‘Maximum number of array’+maximum)
//Maximum number of array2390
const myString = ‘Welcome to my code’
let reverseString = ‘’
const char = myString[i];
//output edoc ym ot emocleW
Find the factorial of 10?
let factorial = 1;
Describe event bubble?
When an event is called it goes to its child-to-child level element and checks if there any event handler here or not. Then it bubbling up one by one with upper level and check if there any event handler here or not. If find its event handler then execute it.