• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 6 páginas
Examen

Javascript Functions Exam Questions And Answers All Correct

Document preview thumbnail
Vista previa 2 fuera de 6 páginas

JAVASCRIPT FUNCTIONS EXAM QUESTIONS AND ANSWERS ALL CORRECT

Vista previa del contenido

JAVASCRIPT FUNCTIONS EXAM
QUESTIONS AND ANSWERS ALL
CORRECT

What is the arity of a function? - Answer-the number of parameters it declares in its
parameter list (read: the number of arguments it expects)

When does a function inherit properties from the prototype object? - Answer-When it is
used as a constructor

What do apply() and call() allow you to do? - Answer-Indirectly invoke a function as if it
were a method of some other object

When is a function recursive? - Answer-A function is recursive if it directly or indirectly
invokes itself

What is a closure? - Answer-A closure is an inner function that has access to the outer
(enclosing) function's variables—scope chain

What three scope chains do closures have access to? - Answer-The closure has three
scope chains: it has access to its own scope (variables defined between its curly
brackets), it has access to the outer function's variables, and it has access to the global
variables.

What is hoisting? - Answer-All variable declarations are hoisted (lifted and declared) to
the top of the function, if defined in a function, or the top of the global context, if outside
a function.

In what order does function declaration, variable declaration or variable assignment take
precedence? - Answer-function declaration takes precedence over variable declarations
(but not over variable assignment).


What is a function? - Answer-A function is a block of Javascript code that is defined
once, but can be executed multiple times.

, What is a function expression? - Answer-it is a variable with a value of a function.

What are parameters? - Answer-A list of identifiers that act as local variables within the
body of the function.

What is a constructor? - Answer-A constructor is a function used for initializing new
objects, and you use the new keyword to call the constructor.

When is a function known as a method? - Answer-When it is assigned to the property of
an object.

When are function names optional? - Answer-For function definition expressions, where
the name refers only to the function object within the body of the function. In essence,
the function name becomes a local variable used within the function. Whereas a
function declaration declares a variable and assigns a function object to it.

What is scope? - Answer-The context in which a variable exists.

What happens if you initialize a variable, but don't declare it inside a local function? -
Answer-It becomes a global variable.

Do local or global variables have priority? - Answer-If you declare a global variable and
a local variable with the same name, the local variable will have priority when you
attempt to use the variable inside a function because the search for a variable with that
name begins inside of the function and moves outward.

What object are all global variables attached to? - Answer-The window object

What happens when you put a function definition inside a conditional (if) block or a
loop? - Answer-Well, don't do that. Different JavaScript platforms in different browsers
have traditionally done different things in that situation, and the latest standard actually
forbids it. If you want your programs to behave consistently, only use this form of
function-defining statements in the outermost block of a function or program.
function example() {
function a() {} // Okay
if (something) {
function b() {} // Danger!
}
}

When is a function the invocation context for an object? - Answer-When a function is
invoked on or through an object

Are function expressions hoisted? If so, can they be invoked anywhere in the code? -
Answer-No, variable declarations are hoisted, but assignments to those variables are
not, so functions defined with expressions cannot be invoked before they are assigned.

Información del documento

Subido en
14 de julio de 2025
Número de páginas
6
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$14.49

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Scholarsstudyguide
3.8
(169)
Vendido
853
Seguidores
476
Artículos
16409
Última venta
1 semana hace




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes