Frontend Developer Interview Questions and Answers (4)
JQuery
Explain "chaining".
http://www.w3schools.com/jquery/jquery_chaining.asp
http://schier.co/blog/2013/11/14/method-chaining-in-javascript.html
Explain "deferreds".
http://api.jquery.com/category/deferred-object/
What are some jQuery specific optimizations you can implement?
http://stackoverflow.com/questions/3230727/jquery-optimization-best-practices
What does .end() do?
Most of jQuery's DOM traversal methods operate on a jQuery object instance and produce a new one, matching a different set of DOM elements. When this happens, it is as if the new set of elements is pushed onto a stack that is maintained inside the object. Each successive filtering method pushes a new element set onto the stack. If we need an older element set, we can use end() to pop the sets back off of the stack.
http://stackoverflow.com/questions/1745814/what-does-the-end-function-do-in-jquery
Name 4 different values you can pass to the jQuery method.
Selector (string), HTML (string), Callback (function), HTMLElement, object, array, element array, jQuery Object etc.
What is the difference between .get(), [], and .eq()?
get(0) returns the first DOM element matched by the selector.
eq(0) returns a jQuery object containing the first DOM element matched by the selector.
In other words, $("selector").get(0) is equivalent to $("selector").eq(0).get(0)
Code
Question: Implement a modulo function that satisfies the following
modulo(12, 5) // 2
Question: What value is returned from the following statement?
"i'm a lasagna hog".split("").reverse().join("");
Answer: "goh angasal a m'i"
Question: What is the value of window.foo?
( window.foo || ( window.foo = "bar" ) );
Answer: "bar" (only if window.foo was falsey otherwise it will retain its value)
Question: What is the outcome of the two alerts below?
var foo = "Hello"; (function() { var bar = " World"; alert(foo + bar); })(); alert(foo + bar);
Answer: "Hello World" & ReferenceError: bar is not defined
Question: What is the value of foo.length?
var foo = [];foo.push(1);foo.push(2);
Answer: 2
Fun
What's a cool thing you've coded recently? What's something you've built that you're proud of?
What are some things you like about the developer tools you use?
Do you have any pet projects? What kind?
What's your favorite feature of Internet Explorer?