DEV Community

Cover image for All front end Interview questions asked during my recent job hunt.

All front end Interview questions asked during my recent job hunt.

Abhijeet Yadav on August 04, 2020

Interview questions for front end This readme is a compilation of all the question asked during my recent COVID-19 job hunt. I've also att...
Collapse
ogrotten profile image
ogrotten

This list of problems to solve is extremely discouraging. I've done Hackerrank/leetcode/codesignal challenges, and most of these seem like things that would take me at least a couple hours. Mainly, I can't even see a 'first step' to a solution after reading the problem. But if you have all these exercises, it means you had all these interviews without being hired... and if they didn't hire you, then what gnats chance in hell do i have?

Congratulations, truly, for getting the interviews, and I thank you kindly for posting these in an attempt to help others learn from your experience.

Collapse
jmmendez profile image
John Mendez • Edited on

These interview questions aren't necessarily meant to be answered on the spot. They're purposely complex so that the interviewer can see your thought and team process.

I was dumbfounded by many interview questions and I'm currently in a few final rounds. One of them is a fortune 500 company, and that's the one I most shaky in and never wrote a full implementation. But by talking my way through it aloud, the interviewer realized that I knew what I was doing and needed more time.

Just make sure to collaborate with the interviewer as if you already work there. Ask questions and provide input as you search for the solution. Understand why you're making certain choices, and the tradeoffs of them. They want to know how you'll be on the job after all.

Any honest developer would agree that if you haven't seen these problems before, it would take more than a couple of hours.

Like, who seriously believes promises were implemented in a day, let alone a couple of hours? And for those who do think that, do you even want to work with that toxic mentality?

The path to the solution is more important than the solution. So focus less on interviewing, and more on acting the same as you would on the job.

Collapse
ogrotten profile image
ogrotten • Edited on

Solid take and advice. Thanks.

Collapse
devabhijeet profile image
Abhijeet Yadav Author • Edited on

Yeah, I know right. It's not like I had it all figured out. The solutions I have posted here are the final ones that I had reached after making countless mistake and a ton of console logs. The toughest amongst them were 1 and 7. On any other day I wouldn't be struggling that much but presenting solution during interview is a whole different ball game.

Also I had cleared a lot of interviews but most of it didn't materialize. Some of the interviews I gave were only to gain experience, even when I was not interested in the company I was getting interviewed at.

Collapse
asiraky profile image
asiraky

I disagree. These questions are not that hard for someone calling themself a software engineer.

Collapse
ogrotten profile image
ogrotten

Very helpful. Congratulations on your new title.

Thread Thread
asiraky profile image
asiraky

A tad unnecessary. Just stating my opinion.

Collapse
rohanhacker profile image
रोहन मल्होत्रा

Your promise implementation is incorrect.
This is how the promise works:
If the handler function:

  • returns a value, the promise returned by then gets resolved with the returned value as its value.
  • doesn't return anything, the promise returned by then gets resolved with an undefined value.
  • throws an error, the promise returned by then gets rejected with the thrown error as its value.
  • returns an already fulfilled promise, the promise returned by then gets fulfilled with that promise's value as its value.
  • returns an already rejected promise, the promise returned by then gets rejected with that promise's value as its value.
  • returns another pending promise object, the resolution/rejection of the promise returned by then will be subsequent to the resolution/rejection of the promise returned by the handler. Also, the resolved value of the promise returned by then will be the same as the resolved value of the promise returned by the handler.
Collapse
devabhijeet profile image
Abhijeet Yadav Author

The implementation is a rough idea.

Collapse
vibhanshu909 profile image
vibhanshu pandey

I believe it's better to provide a correct solution or no solution at all, otherwise, it may mislead our fellow developers into believing it to be the correct solution. You may check out this link for a detailed implementation and explanation of promises. By the way great post. :)

Thread Thread
devabhijeet profile image
Abhijeet Yadav Author

Please read the note before the answer started.

Thread Thread
vibhanshu909 profile image
vibhanshu pandey

Yes, I've read that, it says "not production ready", not that the provided solutions are psudo-code. Anyway great stuff 👍.

Collapse
kalbrecht_fr profile image
Kevin ALBRECHT

Hi, thank you for sharing this but can you explain your getHashCode implementation ?
I though you would compute some values, based on charCodeAt() and maybe bitwise operation or anything, to make it unique, but you simply returned the string instance.

Collapse
devabhijeet profile image
Abhijeet Yadav Author

I expected the same when the interviewer asked the question. However, on further follow up the interviewer asked me to only make a method by the same name available on the instance. Strange 😕

Collapse
kalbrecht_fr profile image
Kevin ALBRECHT

Oh ok weird, thank you.
great blogpost anyway :)

Collapse
constantiner profile image
Konstantin Kovalev

2) Create a promise from scratch

Sorry, but your promise implementation is wrong. then and catch must return new Promise instance but not this. That's why your sample doesn't work correct:

promise
  .then(function(response){
    console.log(response);
  return [...response];
  }).
then(response => {
  console.log(response);
})
  .catch(function(error){
    console.log(error)
  });

Compare results using original Promise.

Collapse
bobgravity1 profile image
bobgravity1 • Edited on

lol. here i am a year into learning JS about an hour a day just mainly for fun. got more serious recently about trying for an entry level front end job and have been applying about 3 hours a day. but after seeing this im crushed... yay! thanks for sharing lol

Collapse
kurtyazdizadeh profile image
kurtyazdizadeh

What types of positions did you apply for? Entry-level? Junior? Mid? Senior level? Just curious!

Collapse
devabhijeet profile image
Abhijeet Yadav Author

It was Software Engineer III position.

Collapse
joshuajrodrigues profile image
Joshua

That makes sense

Collapse
_ezell_ profile image
Ezell Frazier

Absolute insanity.

Collapse
piperymary profile image
Mary

If you are a Node.js developer, here's the list of interview questions that may be asked during the hunt.

Collapse
mlee0330 profile image
Michael Lee

Why does 'two' > 'three' evaluate to true?

Collapse
devabhijeet profile image
Abhijeet Yadav Author • Edited on

For this case, ASCII value of first character from both string are compared. Since the first char is 't' from both string, the resultant ASCII value will also be same. The evaluation then moves to the second character of both string.

Character 'w' from string one has ASCII value greater than ASCII value of character 'h' from string two, hence evaluation will now be of below state...

ASCII(w) > ASCII(h) => true
Enter fullscreen mode Exit fullscreen mode

Also the below evaluates to false

'tWo' > 'three' //false
Enter fullscreen mode Exit fullscreen mode
Collapse
zhuangyin8 profile image
zhuang

11) Convert class based inheritance code given below to ES5 code.
"class Parent(name){ " is wrong.
should be "class Parent { "

Collapse
midnightgamer profile image
Pankaj Jaiswal

All this stuff for Frontend post? I am a fresher starting career in Frontend Development. But I hate DSA from my bottom of the heart. What should I do? These types of questions will freak me out.

Collapse
devabhijeet profile image
Abhijeet Yadav Author

I am not sure if a fresher will be subjected to same questions. However, learning DSA will help you out in long term if you are considering Software development for profession. You can check my Resources for preparation blog. It has links to some youtube channel to get started with DSA.

asiraky profile image
asiraky

Never mind how little sense that makes, the author actually stated he was being interviewed for a Software Engineer position. How is the tag of the post relevant, given that fact.

Collapse
bobgravity1 profile image
bobgravity1

is this type of stuff way beyond a junior front end web dev interview? i f****in hope so lol... i would NEVER be able to answer this

Collapse
rakeshraih profile image
rakeshraih

Children.prototype = new Parent(), shoudn't this be
Children.prototype = Object.create(Parent.prototype); instead of creating new instance?

Thanks for posting, good stuff.