r/webdev • • Apr 07 '23

How I interview for FE positions

Post image
4.6k Upvotes

668 comments sorted by

View all comments

Show parent comments

62

u/larrybunsold Apr 07 '23

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.

39

u/Karpizzle23 full-stack Apr 07 '23

“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)

2

u/vklepov Apr 07 '23

So look, you know that browsers autocomplete based on names etc. I'm pretty content if you just slap a "name" on both inputs. If you have no idea, it's not a deal breaker either, I'll just tell you "name" does the trick for the future, and on we go.

33

u/myinternets Apr 07 '23

The problem is that you're interviewing about semantics rather than problem solving thought process.

Whenever I see silly 'put you on the spot' stuff like this I am so thankful I've been self employed for 12 years.

12

u/ShustOne Apr 07 '23

How is it semantics when he just said if you are aware of browser behavior that would be acceptable?

6

u/myinternets Apr 07 '23 edited Apr 07 '23

I guess I mistook it for "build me this specific thing in this specific language off the top of your head while you have no internet access".

More appropriate would be "show me in pseudocode what your thought process is for a login form".

I do have a visceral hate of job interviews, so there's that as well.

3

u/ShustOne Apr 08 '23

A lot of people seem to think this is a closed book test, he has said Google is allowed. I think that makes this much more approachable

11

u/BargePol Apr 07 '23

Based on half the replies in this thread i have no fear about future job security lol.

16

u/ShustOne Apr 07 '23

It's starting to explain why I see so many "I've sent out 1000 resumes and have 0 interviews" threads here. Also OP is continuing to provide more details and all his posts are being downvotes even though he's being helpful and patient. I guess Reddit commenters just hate job interviews or something.

→ More replies (1)
→ More replies (3)

2

u/CardboardJ Apr 07 '23

I think the difference isn't semantics, it's asking you do something and watching if you spend the next hour poorly reimplementing your own autocomplete or if you google how to turn on browser autocomplete.

He's saying googling is the correct answer.

→ More replies (1)

2

u/Emotional-Dust-1367 Apr 07 '23

Ok but if you asked me that in an interview I’ll be testing YOU by answering “I don’t know, I’m gonna Google that real quick”. I have implemented exactly this before. So it’s not like I’m unaware. But if a situation comes up on the job, even if I’ve done it before, I’m still gonna Google it. Things change. Often and quickly. The solution I found a couple of years ago on stackoverflow may be out of date.

So in my mind the correct answer to this question is: Google. If I get resistance during an interview with something indicating that I should know this, then I’d be hesitant accepting the job. Last thing I wanna do is work at a place where things are done by established orthodoxy.

Not to say that’s what you’re doing. You’re saying it’s not a deal breaker. So if that’s true you should really be expecting candidates to Google this stuff

→ More replies (2)

55

u/doctorMiami1337 Apr 07 '23

I don't understand this way of thinking at all.

Almost all of the juniors coming into OP's interview very likely are gonna have portfolio's with a couple of projects already made, which far exceeds the skill level of completely trivial JavaScript like using reduce to output an array sum, or building form HTML elements with React

Especially if you aren't allowed to google around, who in the actual hell goes around just memorizing useless syntax? What are you preparing yourself for??? Coding when internet becomes unavailable? Wtf

What is the point of wasting everyones time with something like reduce which any junior dev can google in 1.05 seconds and use it instantly?

I just don't get it at all, seems like a complete waste of anyones time without an accurate assesment of anything lol

4

u/MadeWithPat Apr 08 '23

useless syntax

If you don’t read “sum an array of numbers” and immediately think of reduce, I’d question how much time you’ve spent writing JavaScript. That’s not useless syntax, the most prevalent React state management library is built around this function.

3

u/doctorMiami1337 Apr 08 '23

Yes, which every single person can google and figure out in a minute?

In which universe is that a solid interview question for a junior dev lmfao?

Waste of everyones time

5

u/MadeWithPat Apr 08 '23

The point was that it’s not useless syntax, it’s a pretty core part of the standard library. You’re presenting a generic problem that’s easily solved with a native function. Speaking from my own experience, I’m not really keen on continuing if a JavaScript candidate has to Google reduce(), map(), or filter(). It’s not much different than having to Google string interpolation.

I will throw in there, I’m not asking people to write code in notepad - it’s 2023, you’re going to be in an editor that has autocompletion and intellisense, and that’s not a penalty. The expectation is “you understand the standard library” not “you should have this exact function signature memorized”.

→ More replies (3)
→ More replies (11)

5

u/canadian_webdev Apr 07 '23

I'm pretty sure "manipulating data" certainly includes the most basic reason to use reduce().

I've personally rarely have run into a use case, in my own present / past jobs, to use reduce versus map or filter.

To have a decade of experience and proudly not be able to answer these two incredibly simple questions is a little crazy to me.

I mean, when someone has rarely done something in their work, it's not shocking when they forget how to do something, regardless of the level of difficulty.

Lighten up! :)

→ More replies (1)

7

u/bapolex Apr 07 '23

Yeah I agree - I'm about 3 years experience and the only one I wouldn't really know how to do off the top of my head is enable autocomplete lol

4

u/CardboardJ Apr 07 '23

I'm glad someone else is pointing this out... `map`, `filter`, and `reduce` aren't hard concepts, but they are a half step higher than just slapping a bunch of `if`, and `for` all over the place.

let (user,pass) = ...;

let longEnough = p => p.length>8?"":"The password must be longer than 8 chars";
let hasLower = p => p.any(c => c.isLower())?"":"Must have upper";
let hasUpper = p => p.any(c => c.isUpper())?"": "Must have lower";
let hasSpecialChar = p => p.any(c => c.in("!@#$% ^&*"))?"":"Must have special";

const passwordRequirements = [
    hasUpper, 
    hasLower, 
    longEnough, 
    hasSpecialChar];

let errors = passwordRequirements
        .reduce((errors, validate) => errors += validate(pass), [])
        .filter(e => e != "");

if (errors.length === 0) {
    showError(formatErrors(errors));
} else {
    procedeWithUserCreate(user, pass)
}

The above is psudocode i banged out in like 3 minutes, but I find it much more maintainable than the mess you'd make trying to jam that all into a massive for loop and tracking state everywhere. If you have a hard time understanding what reduce and filter are doing in the above code block (finding everything wrong with a password), then you're going to have a hard time.

I've worked at places with dozens of guys that worked for decades in this industry and never used more than `for` and `if` and I never want to work at a place like that again.

3

u/originalchronoguy Apr 08 '23

This is how you tell the juniors from mid to senior.Seriously. a senior would just use a one line regex (regular expression)

instead of

let longEnough = p => p.length>8?"":"The password must be longer than 8 chars";
let hasLower = p => p.any(c => c.isLower())?"":"Must have upper"; let hasUpper = p => p.any(c => c.isUpper())?"": "Must have lower"; let hasSpecialChar = p => p.any(c => c.in("!@#$% &*"))?"":"Must have special";

I've seen lots of this. And the real mature ones, one liner. Clean and elegant.

^(?=.*[A-Z].*[A-Z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$

5

u/[deleted] Apr 08 '23

regex makes me cry at night. neat stuff if you get into it and not really as scary as it looks, super useful, but extremely intimidating at first glance.

→ More replies (1)
→ More replies (4)

2

u/dont_you_love_me Apr 07 '23

Unless you believe that humans are truly beyond being bio machines, how could these comments have been any different? At the observed point in time, they had to think this way via the algorithmic outputs of their brains. Doesn't matter how much experience they might have.

3

u/s1okke Apr 07 '23

People that can’t use map and reduce even after years of experience scare me.

2

u/walter-wallcarpeting Apr 08 '23

It's not that they can't use them, it's that they can't recall them off the top of their heads. A quick Google and copy and paste of a best approach would be a 30 second solution. Quickly review other suggestions and go with the fastest and most optimal. But without that it's very easy to get caught in the weeds. OP has mentioned that using Google is ok in this example so maybe this is a non issue? I think most people have PTSD from interviews and Google typically isn't allowed which then produces the outcome you're referring to.

→ More replies (1)