Skip to content
loading...

70 JavaScript Interview Questions

Mark A on January 03, 2020

Hi Guys Good Day and a Happy New Year πŸŽ†πŸŽ†πŸŽ†! This is a long one, so bear with me for a second or an hour. In every answer for every questi... [Read Full]
markdown guide
 

It's funny how interviews often focus on memorization these kind of things, which are the easiest things to look up when you need them.

Half of these things i encountered and used without' having to know the right name for what i was doing, so whats the value?

Very rarely do i get asked about my thoughts on MVC, component orchestration, function vs Class based programming, what over-engineering is, interesting problems i have solved and how, or just maybe how i handle differences of opinion in PR's.

Comparatively speaking, having those kinds of discussions seem much more relevant than whether or not i have memorized all the latest programmer pop culture and random terms one might use once every blue moon.


That being said.

This is a nice list to memorize if you wanna play the default interview game.
Which i might in the future, so thanks! :)

 

I feel you man but most of the time memorizing or knowing this things are not about answering an Interview problem or problems but solving a problem you are having with JavaScript and btw Glad you like it!!!

 

Great article, well done! πŸ‘

If I was asked any of these at a job interview, I couldn't answer a single one πŸ‘

 
 

Nice work! Most of these are pretty good. If you're a hiring manager reading this though, I'd caution against asking questions like "is using the + or unary plus operator the fastest way in converting a string to a number?" because it really doesn't matter and you shouldn't make hiring decisions based on one's knowledge of that.

 

Great set of questions :) I want to clarify one thing though: "What does the && operator do?" - It does not return last "truthy" or "falsy" value. It returns the last value it has to calculate to determine the truthiness of the whole expression, eg. 0 || 0 || 0 - will return 0 and 1 && 1 && 1 - will return 1. So the statement in the article is not 100% accurate :) Can't wait to see the update ;)

 

Thanks guys for reading this post.

Thank you for the effort.

EDIT: In Question 5 you wrote:

Image if we have an HTML structure like this.

Did you intend to use the word Imagine instead of Image?

 

β€œlet x = 5;

x = (x++ , x = addFive(x), x *= 2, x -= 5, x += 10);

function addFive(num) {
return num + 5;
}
If you log the value of x it would be 27. First, we increment the value of x it would be 6, then we invoke the function incrementBy5(6) and pass the 6 as a parameter”

Do you mean addFive(6)?

I’m new to js, so I’m probably wrong.

 

Thanks for telling me this little problem 😁

 

Thanks for writing the article. I’m enjoying it.

Also,

reduce.apply(obj1, [1, 2, 3, 4, 5]); // returns 15
reduce.apply(obj2, 1, 2, 3, 4, 5); // returns 15

Did you mean reduce.call obj2, 1, 2, 3, 4, 5); ?

 

Hi, I enjoy reading our article, though I found some code that you might wanna check:

In the IIFE section, these examples does not look like valid IIFEs to me;

(() => {

});

const utility = (function () {
return {
//utilities
};
})

Also this function a bit further down is not invoked:

const graphUtility = (function () {
function createGraph() {
// createGraph logic here
}
function drawGraph() {
// drawGraph logic here
}
return {
createGraph,
drawGraph
}
})

 

I think there're a mistake here...!

function myFunc() {
  let a = b;
  a = b = 0;
}
myFunc();

Isn't this invalid syntax...?
It should be:

let a, b;
 

Thanks man, I totally miss that one, hahaha

 

Question #26

var li = document.querySelector('.list-group > li');

Probably here should be querySelectorAll instead of querySelectorπŸ™‚

 
 

I think this is the longest read time I ever see on the internet. Thank you for the article. I'd bookmark for future references.

 

I like this article, quite the refresher.
However, I think people forget quite a bit about the method bind that can do partially applied function! And it's not mentioned here.

 
 

Great article!
Can I translate it into Korean and post it on my blog?
I'll clarify the source.

 

No Problem man and Thanks πŸ˜ƒ!

 
 

Another crazy way for isEven :)

function isEven(num) {
  if (num === 0 || !Number.isFinite(num)) {
    return false;
  }
  return !String(num / 2).includes(".");
}

 
 

Great article!!

Can I translate this awesome article into a Japanese version to share if you let me do?

Thank you!

 
 

"This is a long one", this is a nice one ! thanks. My favorite is the 14, tricky question that seems quite simple but there are a lot things to say.

 

Thanks man! Glad you like it 😁

 

Sheesh. Thanks for the write up but good Lord is this intimidating. Lol. Maybe it's more a reality check.

 
 
 
 

Thank you for the great article. It must be mistake in 1 question when you provide example of casting null and undefined to Boolean, you cast only null in both cases.

 

Thanks man for pointing that one out.

 
 

Great list! Thank you for the efforts and time you took to collect them.πŸ’™πŸ’™

 
 
 

Awesome article! I think that there is an error on the 3rd example of the Set object comments. It should say K and Z instead of "a". Look like a copy paste from the 4th example

 

Thanks man for pointing that one out hahaha

 
 

Thank you for the time and the passion you have spent for this article. It is awesome!

 

Thanks man, I just put all the things that I learned for the past two years, still I feel dumb with JavaScript

 
 

These are great, thanks for sharing!

 

No problem man, and btw Thanks 😁

 

Nice list, my favorite one is what is hoisting :)

 

Thanks, yea Hoisting is pretty fun to learn

 

Awesome!!! πŸ‘πŸΏ
Gratitude πŸ™πŸΏ
Stars ✨

 

Thanks Mark - great cheat sheet! Btw, what does your dog think of the article?

 

Hey. I've translated this post into Persian. I want to thank you a lot!

Here is the link to the post:
ditty.ir/posts/70-javascript-inter...

 
code of conduct - report abuse