- Explain event delegation
- Explain how
this
works in JavaScript - Explain how prototypal inheritance works * — Not full *
- What do you think of AMD vs CommonJS?
- Explain why the following doesn't work as an IIFE:
function foo(){ }();
. - What's the difference between a variable that is:
null
,undefined
or undeclared?- How would you go about checking for any of these states?
- What is a closure, and how/why would you use one?
- What's a typical use case for anonymous functions?
- How do you organize your code? (module pattern, classical inheritance?)
- What's the difference between host objects and native objects?
- Difference between:
function Person(){}
,var person = Person()
, andvar person = new Person()
? - What's the difference between
.call
and.apply
? - Explain
Function.prototype.bind
. - When would you use
document.write()
? - What's the difference between feature detection, feature inference, and using the UA string?
- Explain Ajax in as much detail as possible.
- What are the advantages and disadvantages of using Ajax?
- Explain how JSONP works (and how it's not really Ajax).
- Have you ever used JavaScript templating?
- If so, what libraries have you used?
- Explain "hoisting".
- Describe event bubbling.
- What's the difference between an "attribute" and a "property"?
- Why is extending built-in JavaScript objects not a good idea?
- Difference between document load event and document DOMContentLoaded event?
- What is the difference between
==
and===
? - Explain the same-origin policy with regards to JavaScript.
- Make this work:
duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]
- Why is it called a Ternary expression, what does the word "Ternary" indicate?
- What is
"use strict";
? what are the advantages and disadvantages to using it? - Create a for loop that iterates up to
100
while outputting "fizz" at multiples of3
, "buzz" at multiples of5
and "fizzbuzz" at multiples of3
and5
- Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?
- Why would you use something like the
load
event? Does this event have disadvantages? Do you know any alternatives, and why would you use those? - Explain what a single page app is and how to make one SEO-friendly.
- What is the extent of your experience with Promises and/or their polyfills?
- What are the pros and cons of using Promises instead of callbacks?
- What are some of the advantages/disadvantages of writing JavaScript code in a language that compiles to JavaScript?
- What tools and techniques do you use debugging JavaScript code?
- What language constructions do you use for iterating over object properties and array items?
- Explain the difference between mutable and immutable objects.
- What is an example of an immutable object in JavaScript?
- What are the pros and cons of immutability?
- How can you achieve immutability in your own code?
- Explain the difference between synchronous and asynchronous functions.
- What is event loop?
- Explain the differences on the usage of
foo
betweenfunction foo() {}
andvar foo = function() {}
--
- What do you know about promises?
- How do you check if an object is an array or not?
- Data types in javascript
- Anonymous vs. referenced vs. declared functions
- What are the ways server can push data to the client?
- Describe long polling
- Describe http streaming
- What are server-sent events?
- How would you get currently focused element?
- As
[]
is true,[]==true
should also be true. Right? - What is late binding?
- What does
void
do? - What are WebComponents?
- Why Babel use (0,obj.prop)()?
- What is primitive data type?
- Are loops faster in reverse?
- How
WeakMap
can help you prevent memory leaks? - What is the pros and cons of using
Proxy
vs Getters and Setters? - Why npm shrinkwrap is useful?
--
What is the significance of, and reason for, wrapping the entire content of a JavaScript source file in a function block?
This is an increasingly common practice, employed by many popular JavaScript libraries (jQuery, Node.js, etc.). This technique creates a closure around the entire contents of the file which, perhaps most importantly, creates a private namespace and thereby helps avoid potential name clashes between different JavaScript modules and libraries.
Another feature of this technique is to allow for an easily referenceable (presumably shorter) alias for a global variable. This is often used, for example, in jQuery plugins. jQuery allows you to disable the $ reference to the jQuery namespace, using jQuery.noConflict(). If this has been done, your code can still use $ employing this closure technique, as follows:
(function($) { /* jQuery plugin code referencing $ */ } )(jQuery)