1. What is Event Propagation in JavaScript?
2. What are the phases of Event Propagation?
3. How can we stop Event Propagation?
4. What is Event Delegation?
2. What are the phases of Event Propagation?
3. How can we stop Event Propagation?
4. What is Event Delegation?
👍1
Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
Input: [0,1,0,3,12]
Output: [1,3,12,0,0]
What will be the output?
var a = 1;
function x(params) {
console.log(a)
if(a) var a = 9;
console.log(a)
}
x(10)
var a = 1;
function x(params) {
console.log(a)
if(a) var a = 9;
console.log(a)
}
x(10)
A Teacher of California institute of Technology takes people on yearly trips to museums of science and development for a mind refreshing tour. Total of children depend on their passing percentage and people appearing for the exam. For every section of the museum, the teacher always stands in line and checks if anyone is missing from the queue. All students will be standing in no order in the queue.
Write a code to find the missing child from the queue
Total Students:
Jina, Jeniffer, John, Ronald, Jacob, Joe, Ralph, Surya, Scully, Nina, Scarlet
In Applied science queue standing people
Ronald, Ralph, Scully, Scarlet, Jina, Jeniffer, Joe, Nina, Surya, Jacob
Write a code to find the missing child from the queue
Total Students:
Jina, Jeniffer, John, Ronald, Jacob, Joe, Ralph, Surya, Scully, Nina, Scarlet
In Applied science queue standing people
Ronald, Ralph, Scully, Scarlet, Jina, Jeniffer, Joe, Nina, Surya, Jacob
👍1
Remove duplicates from a sorted non-decreasing Array
input: [1,2,3,3,4,5,5,6]
output: [1,2,3,4,5,6]
input: [1,2,3,3,4,5,5,6]
output: [1,2,3,4,5,6]
👍3
These are some questions I faced in my recent interviews. If you're getting ready for a frontend interview, make sure to review and practice these questions. I'll be sharing more questions over the next few days.
What is Promise in JavaScript and how can you implement a Promise with .then?
What is the output?
console.log(1);
setTimeout(()=>{console.log('setTimeOut')}, 0);
Promise.resolve().then(()=>{
console.log('P1');
}).then(()=>{
console.log('P2');
}).then(()=>{
console.log('P3');
});
console.log(2);
console.log(1);
setTimeout(()=>{console.log('setTimeOut')}, 0);
Promise.resolve().then(()=>{
console.log('P1');
}).then(()=>{
console.log('P2');
}).then(()=>{
console.log('P3');
});
console.log(2);
👍2❤1
What is the output?
(function(){
var a = b = 1;
})();
console.log('b', b);
console.log('a', a);
(function(){
var a = b = 1;
})();
console.log('b', b);
console.log('a', a);
What is the output?
console.log(test3);
console.log(test3());
var test3 = function(){return 3;}
console.log(test3);
console.log(test3());
var test3 = function(){return 3;}
What is memoization and how can you memoize a function in JavaScript
Which is more optimized for finding a value in JavaScript: using an object or a map?
👍1