Front end engineer Interview Questions | Glassdoor.co.uk

Front end engineer Interview Questions

282

front end engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Implement a simple store class with set(Node, value), get(Node) and has(Node) methods, which store a given Nodes with corresponding values.

6 Answers

Are you able to elaborate on this question? Can each node have multiple values or just 1? The way I interpret what you have written, it just sounds like they are asking for an ES6 Map? ES6 Maps can have objects as keys, so you can use the Node as the key. If you had to code it from scratch without the use of an ES6 Map, something like: class CachedNode { constructor(node, value) { this._node = node; this._value = value; } getNode() { return this._node; } getValue() { return this._value; } setValue(value) { this._value = value; return this; } } class SimpleStore { constructor() { this._container = []; } set(node, value) { let cachedNode; if (this.has(node)) { cachedNode = this.get(node); cachedNode.setValue(value); } else { cachedNode = new CachedNode(node, value); this._container.push(cachedNode); } return this; } // you might want to change this method so it returns the Node's value not the CachedNode. // If you did, that would mean adding another method to get the CachedNode. Easy enough. get(node) { return this._container.find((cachedNode) => { return cachedNode.getNode() === node; }); } has(node) { return !!this.get(node); } } If it needed to store multiple values against a node, then just change the single value for a Set or Array.

The tricky part of the question was on how to store a DOM Node which is an object as an old javascript object key. I can't recall was it about 1 to 1 relationship or 1 to many, but it is really doesn't matter because the later gives just a small overhead. I suppose your solution is pretty what they were expected from the task, starting from explaining ES6 Map and ending up with an old javascript solution.

``` let Store = Map; ``` The problem listed the exact behavior and method signature of the Map class. Must be some trick question.

You have a bag containing an unlimited amount of tennis balls and five boxes which you are trying to throw then into. For every throw you are guaranteed to get a ball in one box. What is the minimum probability of getting 11 balls in any one box.

4 Answers

Do I build with code outside of work, and if so can you tell us about any projects?

2 Answers

What's the difference between a class and id in and why would you use one over the other?

2 Answers

Write a function that satisfies the following: add(1)(2).value() = 3; add(1, 2)(3).value() = 6; add(1)(2)(3).value() = 6; add(1)(2) + 3 = 6;

1 Answer

Technical assessment

1 Answer

Can you describe progressive enhancement

1 Answer

I was asked about 3 questions in total..

1 Answer

How long would it take you to build this page?

1 Answer

Name software design patterns and why they are useful.

1 Answer
110 of 282 Interview Questions