- Event delegation allows you to attach an event listener to an element.
- The difference between
null- the intentional absence of any object value,
undefined- assigned to variables that have just been declared and undeclared - undeclared variables do not exist until the code assigning to them is executed, and how to check for them.
- The difference between a forEach loop (iterates over an array) and a .map() loop (transposes arrays) and when to use them
- Anonymous functions and when to use them - For example, when attempting to sort in a non-standard way, it may be easier to contain the sorting logic as an anonymous function instead of creating a named function
- Software design and code organisational patterns such as the module pattern, classical inheritance, Model–view–presenter, Model–view–adapter, Model–view–viewmodel
- Expressions versus statements - a statement performs an action (eg: loops and ifs), expressions produces a value (eg: as an argument in a function call) and function constructors
- The difference between .call and .apply, call counts the number of arguments separated by comma, while apply uses array as an argument
- Browser detection is bad, Feature detection is not browser detection, instead libraries such as Modernizr use feature detection
- JSONP is JSON with Padding, used to request data from a server residing in a different domain than the client, but has since seen replaced by CORS due to security concerns
- Event bubbling, where the event first triggers on the innermost target element, and then successively triggers on the ancestors (parents) of the target element in the hierarchy till it reaches the top.
- The difference between an “attribute” - belonging to a HTML element and a “property” - belonging to an object.
- The difference between window load event - when all the resources have loaded and document DOMContentLoaded event is when the DOM is ready to interact with
- Comparison operators: Strict comparison (===) is only true if the operands are of the same type and the contents match, while the regular abstract comparison (==), just checks content.
- Same-origin policy: Due to the rise in AJAX and cross-domain requests this raised some security concerns, to mitigate this, the same-origin policy was introduced
- Don’t touch the global scope, in the same way you wouldn’t use global variables
- Single page app: a web application or web site that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server, making them SEO friendly is not trivial, you need to be able to cache and serve static content
callbackhell, Promises may help you to write more maintainable code, but consider that you might not need Promises
- Debugging: Use debugger, Chrome DevTools, the Console, etc
setTimeout()can be used to offload CPU-intensive tasks to the next event loop cycle
- Declaring variables:
const- Constant, immutable,
let- declares a block scope local variable,
var- declares a variable
- Function constructors: In ES6 (ES2015) if you try to call a class constructor without
new, it will always throw an error.
- Arrow functions: An arrow function expression has a shorter syntax than a function expression and you no longer need to bind
this. Arrow functions are best for callbacks or methods like map, reduce, or forEach.
- Template Literals: String literals that allow embedded expressions, allowing multi-line strings and string interpolation features
- Curry functions: a process to reduce functions of more than one argument to functions of one argument with the help of lambda calculus
- Spread syntax: allows an iterable (eg: array) to be expanded in places where zero or more arguments are expected, like in function calls. The remaining properties are assigned to the variable after the spread operator
- Node.js: A runtime system that can be used to power your backend
- Use Linting: analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. Use ESLint
- Use an IDE: a software application that provides comprehensive facilities to computer programmers for software development, such as VScode or Atom