- Barajar
ActivarDesactivar
- Alphabetizar
ActivarDesactivar
- Frente Primero
ActivarDesactivar
- Ambos lados
ActivarDesactivar
- Leer
ActivarDesactivar
Leyendo...
Cómo estudiar sus tarjetas
Teclas de Derecha/Izquierda: Navegar entre tarjetas.tecla derechatecla izquierda
Teclas Arriba/Abajo: Colvea la carta entre frente y dorso.tecla abajotecla arriba
Tecla H: Muestra pista (3er lado).tecla h
Tecla N: Lea el texto en voz.tecla n
Boton play
Boton play
16 Cartas en este set
- Frente
- Atrás
Diferences between variables undefined, variables undeclared and null?
|
- Undeclared when it has not been declared using var.
- Undefined is when we call a variable that has not been defined. Variables do exist. - Null is when a variable has been defined using a value null. |
What is a closure and when and why would you use one?
|
- Functions encapsulated within others, which have access to the variables of the function that contains them. It's any function that remains available even after the external function has been returned.
- Is when a function remember its lexical scope even when the function is executed outside that lexical scope. |
What is THIS in Javascript?
|
- At the time of execution of every function, the JavaScript engine sets a property to the function called this which refer to the current execution context. Depends on how the function is called.
- In the global context or inside a function this refers to the window object. - While executing a function in the context of an object, the object becomes the value of this - Inside a setTimeout function, the value of this is the window object. - If you use a constructor (by using new keyword) to create an object, the value of this will refer to the newly created object. - You can set the value of this to any arbitrary object by passing the object as the first parameter of a bind, call or apply |
Mention at least 5 design patterns in JS
|
Constructor, Module, Singleton, Prototype, Factory
|
Can you explain the Module Pattern in JS
|
The Module pattern is used to mimic the concept of classes so that we can store both public and private methods and variables inside a single object.
That allows us to create a public-facing API for the methods that we want to expose to the world, while still encapsulating private variables and methods in a closure scope. 1. Maintainability 2. Namespacing 3. Reusability |
Differences between .call and .apply
|
- The basic difference between .call() and .apply() is in the way arguments are passed to the function.
- Call and apply, both take the value of this as the first parameter. However, the call takes a collection of arguments after the first parameter whereas apply use an array of arguments as the second parameter. |
What is hoisting?
|
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution
|
What is event bubbling?
|
Events propagate up to the next element is called bubbling
|
What is event delegation?
|
Event delegation is registering an event from a parent node will delegate to their child's node.
|
Differences between =, == and ===?
|
Double equals == checks for equality, triple equals checks for equality and type
|
Differences between var, let and const?
|
var declarations are globally scoped or function/locally scoped. It can be re-declared and updated. So var variables are hoisted to the top of its scope and initialized with a value of undefined.
let is block scoped. let can be updated but not re-declared. |
What is a callback hell and how it can be fixed?
|
It a function declared inside another.
It can be fixed using promises or async-await. |
What is a promise?
|
Is an object that is waiting for an async operation to complete.
|
What are the data types in javascript?
|
There are 2 Data types, primitive type, has a fixed size in memory. (String, Number, Boolean, Symbol, Null and Undefined).
Reference type, do not have a fixed size in memory. The variable stores a reference to the value (Object, Array, Functions, Date) |
What is a pure function?
|
- It must not mutate the current state directly.
- It must not use any data outside of its arguments. - A pure function will always return the same value, given the same set of arguments. |
What is Object.assign()?
|
Is a method used to copy the values and properties from one or more source objects to a target object.
- Object.assign() is used for cloning an object. - Object.assign() is used to merge object with same properties. |