Interview questions 2022 basic javascript
I have attended many interviews when transitioning from one company to other company. There are set of common questions that are asked in the interviews as L1/base/beginner/foundation level JavaScript questions, you are expected to answer them in the initial stage of screening.
Following are the questions that I was asked during my interviews but going through these or mugging up these question and answers DOESN’T make you a “developer”. So, I haven’t posted any sort of answer down here.
Go through them understand the concepts, play with the code, become a developer and crack the interviews.
JavaScript
- Higher Order Functions
- Event bubbling
- Closures
- Function currying
- Event Loop
- Promises, async and await differences
- De-bouncing technique
- call, apply, bind methods and their use cases
- Advantages and disadvantages of SSR over CSR
- Given an array find the second largest and second smallest number
- How to create custom elements
- Ways to stop redirection
- Difference between DOM, V-DOM and Shadow DOM
- ES6 concepts — Scope, Destructuring, spread and rest operators, WeakSet
- Difference between the regular functions and arrow functions with examples and use case
- What is Webpack and babel
- Sequence of logs and why?
console.log('start')
let a;
console.log(myFunction)
function myFunction(){
console.log(a)
a = 10
console.log(a)
}
myFunction()
setTimeout(() => {
console.log("timeout")
}, 0)
fetch(/* some url */)
.then(() =>{
console.log(response.json()
})
console.log('end'))
18. Binding — output of the following code and why?
const User = {
name: 'ABC',
};const User1 = {
name: 'XYZ',
};function printName(age, city) {
console.log(this.name, age, city);
}const boundedPrintName = printName.bind(User);const boundedNewPrintName = boundedPrintName.bind(User1);boundedNewPrintName(26, 'Pune');
19. Implement the following
calculate.add(5).multiple(5).substract(3).divide(11).value() //output 2
20. What is the output of the following code
let a ={}
let b = {key: 'b'}
let c = {key: 'c'}a[b] = 78
a[c] = 34console.log(a[b])
I will be writing more on the HTML, CSS, javascript, vue, react and laravel.
Let me know if there are any kind of mistakes or any basic questions that I missed in the comments.