Test
Scope
Este test tiene tipos de pregunta que se abren en el reproductor de siempre.
Preguntas del test (5)
1Variables that are created within the body of a function are available only in the context of that function. This is referred to as [blank_start]local[blank_end] scope.
- Alocal
- Bglobal
2In the following block of code, what is part of the scope that is local to the function?
var tax = 0.08;
function calculateTotal(subtotal) {
var total = subtotal + (subtotal * tax);
return total;
}
console.log(calculateTotal(50));- Atax
- Bsubtotal
- Ctotal
- DcalculateTotal
3In the following block of code, what is part of the global scope?
var tax = 0.08;
function calculateTotal(subtotal) {
var total = subtotal + (subtotal * tax);
return total;
}
console.log(calculateTotal(50));- Atax
- Bsubtotal
- Ctotal
- DcalculateTotal
4Shadowing is when we accidentally override (or shadow) the value of a variable inside a function.
- AVerdadero
- BFalso
5What kind of error is thrown when we try to access a local variable in the global scope? (Hint: If you're not sure, go try it out in your JavaScript console first!)
- AReference Error
- BSyntax Error
- CType Error
Información
- Descripción
- Test sobre Scope, creado por Code Ramp el 02/06/2018.
- Autor
- Code Ramp
- Idioma
- English
- Visitas
- 265
- Etiquetas
- Valoración
- Aún sin valoraciones Valora este test