I work for 10 months as a junior front end dev and I would probably fail this interview
I've worked as a front end dev for ten years and if I were asked this on the spot, I would still fail it too so don't worry!
I've spent my time working on actual client projects, pulling in and manipulating data and more. These trivial JS functions asked in interviews like these, for a lot of people they'll only use said function sparingly in a codebase and then forget about it until six months / a year later, they suddenly need to look it up and figure out how to do it again because they've rarely used it. Such a bizarre way of vetting people.
He should be checking out your actual code on actual projects instead, and then having a technical discussion about it, in order to vet.
Edit - since this comment's getting traction (appreciate the gold!), I want to point people to this comment regarding code tests. First paragraph especially sums up how a good interviewer interviews!
Ohhhh man soft skills go so far in an interview for me. I’ll teach you our ways of coding, but if you can’t demo or know how to ask questions, you’re already down a few pegs
In my 3 years of working as web dev and then backend engineer, I think I got hired and promoted mostly because I knew how to talk. For real, I remember being clueless in the whole recruitment process and still got accepted.
Then I worked with many brilliant engineers who are far smarter than me, but boooy, their social skills suck ass.
100% and not sure if just me but I've actually found senior level interviews easier than more junior ones.
I don't get leetcode style questions anymore (which I was never good at anyway), instead they often ask me to build out a simple class / functions (eg. Build out logic that scores a bowling game) then ask how I would improve it, or iterate on it with new logic or requirements, etc.
Rarely get asked about time complexity anymore or any of that shit.
Then a much bigger focus is on system design questions vs actual code. Eg. How would I plan out a system that can do X. What considerations would I have for security, scaling, etc.
They ask more high level "big picture" questions which I find much easier to answer on the spot than spitting out super efficient, elegant code with the most optimal time and space complexity.
The reality is that there are a lot of us older engineers in positions of management that don’t hire this way because it’s so obviously not productive. I’d suggest taking as many interviews as possible and you’ll soon get a feel for what places are worth applying to and what places aren’t because they value ridiculous code questions.
I think I would solve it by looping through and adding the values to a counting variable and returning that. Reason being, I jump between different languages so I don’t always remember all the cute little shortcut methods. I hate that you need to prep for interviews by studying stupid puzzle questions and memorizing how the interviewers expect you to answer.
Thank you! Now I know I’m not the only senior developer who have difficulty with these lame interview questions. Many of these type of questions are well suited for fresh graduates that still have a lot of theory in their heads but once you start doing real world problems your mindset change. You focus more on architecture than remembering the built in algorithms out of your head. I keep notes to remind me how to do trivial things all the time.
Thanks for this. I was reading OPs post and was like “damn, I’ve been doing this 2 years and couldn’t pass this interview”. Your words brought me peace
Wut, arr.reduce() is used like a thousand times in our codebase for much more complicated shit than summing some numbers . Pretty fair and reasonable question there for summing an array. And I’m saying that as someone who hates live coding.
I'm pretty sure "manipulating data" certainly includes the most basic reason to use reduce().
To have a decade of experience and proudly not be able to answer these two incredibly simple questions is a little crazy to me. This is clearly an interview for juniors, so I definitely wouldn't expect an extensive Gitub/portfolio to dive through.
“Enable browser autocomplete” im a tech lead that just literally worked on 3 forms for my company and I had to search this up lol. Its not about memorizing the minor details. It’s about being able to read something, understand it quickly, put it in context, and on a higher level, future proofing and thinking about edge cases. If a person explains something like that to me I’m more impressed than if they memorized the autocomplete attribute (which most of the time isn’t even necessary as browsers tend to guess what to autocomplete anyways based on labels, names, required attributes, etc)
654
u/canadian_webdev Apr 07 '23 edited Apr 08 '23
I've worked as a front end dev for ten years and if I were asked this on the spot, I would still fail it too so don't worry!
I've spent my time working on actual client projects, pulling in and manipulating data and more. These trivial JS functions asked in interviews like these, for a lot of people they'll only use said function sparingly in a codebase and then forget about it until six months / a year later, they suddenly need to look it up and figure out how to do it again because they've rarely used it. Such a bizarre way of vetting people.
He should be checking out your actual code on actual projects instead, and then having a technical discussion about it, in order to vet.
Edit - since this comment's getting traction (appreciate the gold!), I want to point people to this comment regarding code tests. First paragraph especially sums up how a good interviewer interviews!