JavaScript Interview questions
August 15, 2020
Those are just some random questions I sometimes ask when evaluating junior developers.
⭐
- What is the difference between
==
and===
? -
What is the output ?
const animals = {}; ['zebra', 'horse'].forEach(function(k) { animals[k] = undefined; }); console.log(animals); ?
⭐⭐
-
What is the difference ?
[1,2,3].map(/*() => { ... }*/); [1,2,3].forEach(/*() => { ... }*/);
-
What is the output ?
const numbersAndStuff = [0, 2, 4, 6, undefined]; const filtered = numbersAndStuff.filter(element => element); console.log(filtered);
- What is a closure ?
- What is a Promise ?
-
What is the output ?
function updateUserName(user, name) { user.name = name; return user; } const john = { name: 'John', age: 48, }; console.log('John', john); const jane = updateUserName(john, 'Jane'); console.log('Jane', jane); console.log('John', john);
⭐⭐⭐
- What is the event loop ?