ES6 terminology === ### A - **arrays**: store multiple values in a single variable. - **arrow functions** allow us to write shorter function syntax: ### B ### C ### D - **data type**: - - **primitives**: - - Boolean Null Undefined Number String Symbol ### E ### F - **function**: block of code designed to perform a particular task. ### G ### H - **hoisting**: moving declarations to the top. ### I ### J ### K ### L ### M ### N ### O - **object**: set of key value pairs. - **events**: are the part of every HTML element that contains a set of events that can trigger the JavaScript code ### P ### Q ### R ### S - **scope**: accessibility (visibility) of variables. - - Local scope - inside function - - Global scope - outside function - **strict mode**: not allowed you can not, for example, use undeclared variables ### T - **this**: keyword refers to parent object. ### U ### V - **variables**: containers for storing data values. ### W ### X ### Y ### Z Interview Questions === #### 1.Two programming paradigms important for JavaScript? - Prototypal inheritance (also: prototypes, OLOO (objects linked to other objects) pattern). - Functional programming (also: closures, first class functions, lambdas). #### 2. What is functional programming? - Functional programming is an concept in JavaScript (one of the two pillars of JavaScript). - Pure functions (same input, will always return the same output. function plus(x, y) { return x + y; }) - Avoid side-effects (A "side effect" is any effect other than return value. function plusWithSideEffects(x, y) { alert("This is a side effect"); return x + y; } ) - First-class functions (can be assigned to a variable, passed as an argument, returned from other function) - Higher order functions (A Higher-Order function is a function that receives a function as an input argument or returns a function as output.) #### 3. What is the difference between classical inheritance and prototypal inheritance? - Class Inheritance: create new instance - Prototypal Inheritance: create reference to parent object #### 4. JavaScript OOP vs Functional - In OOP, an object is a box containing informations and operations that refer to the same concept. - Informations are often known as "attributes", and operations are often known as "methods". - In FP, the code is essentially a combination of functions. Avoid side effect. #### 5. When is classical inheritance an appropriate choice? - Never #### 6. When is prototypal inheritance an appropriate choice? - Any time you need inheritance. #### 7. What are two-way data binding and one-way data flow, and how are they different? - Two-way: if you change UI field, model data is changed as well. - One-way: only model can be changed. #### 8. What is asynchronous programming, and why is it important in JavaScript? - Asynchronous programming means that the engine runs in an event loop. In this way, a single program thread can handle many concurrent operations. #### 9. Explain event delegation. - Event delegation allows you to avoid adding event listeners to specific nodes. Instead, the event listener is added to one parent. That event listener analyzes bubbled events to find a match on child elements. #### 10. Explain how prototypal inheritance works -