DEV Community

loading...

Discussion on: Top 30 Javascript Interview Warmup Exercises

theodesp profile image
Theofanis Despoudis Author

In that case I would ask you to implement array.reduce.

Or to spice things up I would ask you not to use any of:
array.reduce or array.reverse.

So the intention here is that interviewer would like to see how you write plain old for/while loops and how you explain the code as you write it.

Thread Thread
dexygen profile image
George Jempty

Asking somebody to implement Array.prototype.reduce would be absurd IMO after the interviewee had used it to successfully answer your question. And to handcuff somebody by making them use for loops is also absurd. Neither of these are real-world scenarios, and it would seem to me you are just either trying raise the bar impossibly high, or wanting to show off your seemingly superior abilities or such. In which case I'd make the decision then and there I wouldn't want to work for you. Actually a much better real world scenario would be to ask somebody how to re-implement something that relied on excessive chaining. Oftentimes the answer is reduce, but I could also live with a for loop, as long as the original data set is looped over only once.

Thread Thread
theodesp profile image
Theofanis Despoudis Author

That also depends on the company. For some array.reduce might be too simple, but for others might be a good example.

For example if, say you applied for Google and asked about to implement array.reduce you would be really lucky to have that. And if you posted your experience in Leetcode for example, everyone would ask if you are real.

You would not know what the actual bar is until you done some research or took the test.

However I think that's not the point. The main point is how you react to new change of requirements and what is your attitude towards this.

That is the most difficult test.

Thread Thread
dexygen profile image
George Jempty

You keep "moving the goalposts" IMO. Have a nice day.

Thread Thread
jonrandy profile image
Jon Randy

By the same logic, why are you returning a built in Promise in example number 5 rather than your own implementation of a Promise?

Thread Thread
theodesp profile image
Theofanis Despoudis Author

Because we don't want to test how to implement a Promise but their usage.

That would not stop anyone from asking you how Promises could be implemented, but that would fall out of the scope of the warmup. It would be a more challenging test for a more advanced scenario.

See for example:
promisejs.org/implementing/

Thread Thread
dexygen profile image
George Jempty

Again, "moving the goalposts" -- "we don't want to test how to implement a Promise but their usage". Just substitute "Array.prototype.reverse" or "Array.prototype.reduce" and then re-consider your prior arguments and whether what you had suggested "would fall out of the scope" of the warmup.

So far I think you've been very unreasonable/illogical. These are not good traits in a developer/developer-interviewer and I now know beyond a doubt there is no way I'd take a position with you, and I might even just terminate the interview abruptly. With 20 years experience I consider myself to be interviewing the company just as much as vice versa.

Feel free to have the last word but I won't be reading/responding.

Thread Thread
jonrandy profile image
Jon Randy

So you've decided not to move the goalposts on this one?

Thread Thread
theodesp profile image
Theofanis Despoudis Author

There is no hidden agenda. Again if you are condescending or arrogant with someone asking a simple question trying to understand how you think and communicate then you are responsible for yourself and your actions. Good luck with that attitude.

BTW. It only took a few answers on my part in a popular platform like dev.to to understand that from your reactions and I'm a total stranger trying to share my opinion. I'm not even a real interviewer or hiring anyone. How good is that for you?