Live data from Hacker News

Ask HN: How to prepare for a Front-end Developer interview?

news.ycombinator.com

141–146 of 146 posts

Re: Ask HN: How to prepare for a Front-end Developer interview?

#141

Generally, I start by getting an idea of how well a candidate understands JavaScript with a problem like this: Write a function that enables the following API... createOlympian() .name('Katie Ledecky') .sport('Swimming') .country('USA') .log() // Katie Ledecky, Swimming, USA Next, if things are going well, I have the candidate transform a JSON collection response to match some arbitrary requirements using Lodash/Unde…

Pointers on how to improve this (while maintaining your API) would be great :) var createOlympian = function() { return (function() { var attrs = []; // private variable for our olympian attributes var olympian = { name: function(name){ attrs['name'] = name; return this; }, sport: function(sport) { attrs['sport'] = sport; return this; }, country: function(country) { attrs['country'] = country; return this; }, log: fu…

This would work, but attrs should really be an object (i.e. var attrs = {};), not an array, since you're storing string keys, and stylistically you can just use e.g. attrs.name instead of attrs['name'].

Re: Ask HN: How to prepare for a Front-end Developer interview?

#142

Here are a few questions/problems I was asked in from-end interviews a couple months ago: Write a function that accepts an array of ints and a target number. If two of the numbers in the array can add up to the target, return their indices. (aka Two Sum) Write a function that accepts an int x and prints a spiral of "#"s so that the number of "arms" in the spiral equals x. Write a function that accepts a month and a y…

>>The good interviewers, IMO, gave me a "take-home" problem of building some mini front-end app that hit an API, and the really fun one involved reverse engineering an unpublished API - that's how I got my current job. I agree with you, but whenever this subject comes up, a lot of folks here on HN complain that they have full-time jobs and families and don't have time for "take-home" questions.

I understand that point, but I just personally hate the stress and the irrelevance of the "over-the-shoulder" algorithm problems that a recent CS grad would be almost more suited to answering. If I'm really interested in working for a company, I have no issue spending a couple hours building a little app to prove my chops.

Re: Ask HN: How to prepare for a Front-end Developer interview?

#143

You should at least be familiar with the major front-end libraries and frameworks - React, Angular and Ember. You don't necessarily need to "know" them, but at least know about them. You should be familiar with what ES6 is and what Babel does. These technologies probably won't be specific questions per se but if they come up and you can't speak about them, it'd be a red flag. Even for a front-end developer you should…

Can somebody provide a real example of where you'd need to use "linked lists, binary trees, min/max heaps, depth/breadth first search, tries, recursion, hash tables, etc" in your typical everyday front end angular/react/ember project?

I've used hash tables a fair amount in an order processing front-end app. In our batch order processing component, it was useful to hash the orders returned from the API on their "order_id" for fast and easy access to them in various stages of processing. You don't want to be using Array.find() every time you need to refer to an order.

Re: Ask HN: How to prepare for a Front-end Developer interview?

#144
post #122

Earlier quoted context omitted.

Pointers on how to improve this (while maintaining your API) would be great :) var createOlympian = function() { return (function() { var attrs = []; // private variable for our olympian attributes var olympian = { name: function(name){ attrs['name'] = name; return this; }, sport: function(sport) { attrs['sport'] = sport; return this; }, country: function(country) { attrs['country'] = country; return this; }, log: fu…

Bonus points for being meta? function createOlympian() { let props = ['name', 'sport', 'country'] let olympian = { log() { console.log(props.map(prop => this[prop]).join(', ')) } } props.forEach(prop => { olympian[prop] = function(value) { this[prop] = value return this } }) return olympian }

This is neat, but those functions can only be used once.

Re: Ask HN: How to prepare for a Front-end Developer interview?

#146
post #105

Earlier quoted context omitted.

Can you clarify what you mean by xhr throttling? Implementing something like _.throttle to wrap requests?

Hopefully not! Surely _.debounce would be more appropriate to avoid locking out your UI - or worse, returning out of date responses - but even then you would potentially want to handle the responses more robustly. Not to mention needing to handle .fetch()s lack of abort if you're not using xhr.

How can a throttled vs debounced xhr request "lock out the UI"?
Post reply on HN