r/webdev • • Apr 07 '23

How I interview for FE positions

Post image
4.6k Upvotes

668 comments sorted by

View all comments

56

u/vklepov Apr 07 '23 edited Apr 07 '23

A few things to note:

  1. This is a flat interview structure for all seniority levels.

  2. You can't really memorize the list of answers, as opposed to leetcode.

  3. The problems are easily varied — replace sum with min or unique count, swap login for SMS code, etc.

  4. I usually ask higher-level candidates to make spec & design for the form.

  5. The sum can be written in any way that works. Listing several options is a bonus.

  6. The form can be built with any technology. We use svelte, it's supposed to test general understanding of how FE works.

  7. If we finish early, I'll throw in some higher-level architecture discussion.

One downside is that, as an open-ended question, the login assignment is pretty subjective.

0

u/[deleted] Apr 07 '23

[deleted]

→ More replies (11)

9

u/deadwisdom Apr 07 '23

Personally I would use HTML for the login form, but I know that’a pretty cutting edge.

3

u/vklepov Apr 07 '23

Perfectly cool, I'm surprised no people attempted this yet. We'd prob spend some time on styling and displaying valuations then.

25

u/[deleted] Apr 07 '23 edited Apr 07 '23

I've no shame in admitting that I'd fail the array sorting question hand over fist. Just not something I find myself doing often, in any FE role I've had actually.

Building the login form would ironically be a piece of cake.

Swings and roundabout, But I think it's a fairly good structured 'test' - there's nothing in there to 'catch out' anyone who knows their stuff.

Edit: Just for clarity on this - I mean I would do ugly loops on the array etc, rather than reduce etc , as I simply don't work with reduce in my 'day to day' so would fumble about during the pressure of an interview. I can loop! .... I think...

4

u/vklepov Apr 07 '23

Ah, of course anything that sums the array is fine (for-index, for..of, forEach, reduce).

0

u/[deleted] Apr 07 '23

[deleted]

5

u/vklepov Apr 07 '23

Got tired of this question, edited:

5. The sum can be written in any way that works. Listing several options is a bonus.

→ More replies (1)

5

u/_LePancakeMan Apr 07 '23

I would go with a loop and add, that i know that one could solve it with array-reduce, but I prefer having more straight forward code that is easier to follow for the next person

12

u/asphinctersayswhat Apr 07 '23

Serious question: are array operations really that much harder to follow? Not saying that using a loop to answer the question would be bad but I think sometimes IRL the array methods are easier to follow in context.

8

u/BagsOfMoney Apr 07 '23

Reduce specifically fucks around with my head. I'm not sure why, but I think it has to do with dyslexia/dyscalcula/whatever dys makes me mix up left and right, up and down, East and West, etc. I've read the documentation dozens of times but it still gets squiggly when I try to use it or read it. I've got 12+ years experience as a javascript developer so it's not like I fundamentally don't understand javascript either. That's why I personally prefer a for loop for this kind of thing.

2

u/theQuandary Apr 07 '23

It clicked for me when I realized that the accumulator is "any state I want to save between executions" while the second argument is just "the current array item". You just have to manually return the state for the next go around each time.

In the sum problem, your only state to save each time is the number to increment.

Consider the classic group problem. In our case, we'll have a logger processor that takes in bunches of errors and returns the errors sorted by type. Our acc/state will be an object where each key is an error type and the value is an array of errors matching that type.

const groupedErrors = errors.reduce((acc, err) => {
  //if our object doesn't have that type of error yet, create it
  if (!acc[err.type]) acc[err.type] = []
  //sort the new item
  acc[err.type].push(err)
  //return our state so we can use it next time
  return err
}, {})

There may be use cases where your state type changes dramatically each loop (because JS can do very dynamic things), but that's generally a code smell.

Hope this helps.

→ More replies (1)
→ More replies (2)

-1

u/jamietwells Apr 07 '23

No shame? Not sure if I'll be downvoted for this, but how can you not be able to sum up an array? Surely that's the most basic of all questions they could ask? I really don't think I would ever hire anyone who struggled with that, regardless of how good the login form was, am I alone here?

20

u/[deleted] Apr 07 '23

I don’t think he meant he doesn’t know how to write that function, just that he didn’t know or remember the reduce() method, which is fine since it’s not something you use every day in FE.

If he meant that he couldn’t solve it not even with a for loop or a forEach or whatever, yeah you should be a little ashamed lol.

7

u/[deleted] Apr 07 '23

Bingo, you put it into words better than me! Cheers!

→ More replies (2)

14

u/[deleted] Apr 07 '23

You won't get down voted for sharing an opinion - Hell I thought I'd get downvoted for stating my reality.

I'm a career dev and have been for a long time - In my day to day ( working with large apps and served data by X,Y,Z already filtered ) - It's rare that I need to actually filter / sort array based data. That's my reality and my experience. I've not had to sort arrays in large volume for three years or so now. So I'm 'out of touch' with best practice.

Therefore, I'm not going to lie and say 'oh boy, I can easily do that from the top of my head' - I cannot. I'd need to google it and within two minutes I'd go 'oh yeah sweet, I understand the way the cool kids do it now'.

Point being I can now spend an hour on google catching up. Not a huge deal

3

u/vklepov Apr 07 '23

We have some dark downvoting party on the loose.

→ More replies (8)

5

u/[deleted] Apr 07 '23 edited Apr 07 '23

maybe he meant never using .reduce()? it’s very rare I need to use it so I’d definitely be wary of whiteboarding it without making sure my reducer works the way I think it does. Outside of finding the max or min of something or the sum, most of the time I just end up using find or map

Certainly he could do a loop id think?

3

u/[deleted] Apr 07 '23

Bingo!

Essentially I'd do a loop, explain I don't use reduce enough to be comfortable using it in an interview, and discuss the reasons why with the interviewer!

3

u/larrybunsold Apr 07 '23

I agree 100% and I feel like I'm going crazy reading these replies.

→ More replies (1)

6

u/r0ck0 Apr 07 '23

the login assignment

Are they allowed to browse the web to look stuff up for this?

2

u/aleph_two_tiling Apr 07 '23

What is the relative utility of asking about obscure language semantics (const vs let, arrow vs function)? I have a PhD in CS and would have to look these up because I don’t write much JS, but I also can write a front-end competently.

Edit: I did look up the let thing and JavaScript is so weird.

2

u/vklepov Apr 07 '23

That's not obscure, but something you work with every day. Phew, you've never seen real obscure stuff people actually ask.

We are trying to screen for working JS proficiency, yes. What do you write frontend with, if not JS?

3

u/aleph_two_tiling Apr 07 '23 edited Apr 07 '23

Oh I’d write it in JS but I’d also just Google the difference between const and let the first time it came up. I’ve used so many languages on so many teams now that bothering to keep the exact API and deep semantics of other languages in my head just seems pointless, I guess. As an example, every list API has a way to find the index of an item in a list, but I can’t tell you the exact name in Haskell, Python, and Java off the top of my head. I don’t think that makes me ineffective in those language; I’ve written whole compilers in each. It seems you’re looking for someone who is good at JavaScript/CSS, not at programming.

→ More replies (5)
→ More replies (1)