• ¿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 5 páginas
Examen

Javascript Array Exam Questions And Answers

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

JAVASCRIPT ARRAY EXAM QUESTIONS AND ANSWERS

Vista previa del contenido

JAVASCRIPT ARRAY EXAM QUESTIONS
AND ANSWERS

What happens when you call an array index that does not exist? - Answer-It returns
undefined because it is a type of object property

How can you make a value of an array spare? - Answer-Use the delete operator to
delete a pre-existing value or specify a value at an index using a[995] = 100; So the
value of index number 995 of a array is now 100.

What happens if you set a new length to an array that is smaller than the current length
of it? - Answer-The values of index numbers larger than the new length of the array will
be deleted.

What is the value of the length property? - Answer-i + 1 because the first index number
= 0.

What is an array? - Answer-An array is an ordered collection of values.

What is a element? - Answer-An element is a value in an array.

What is an index? - Answer-The ordered position of the elements in the array.

Are arrays typed or untyped? - Answer-JS arrays are untyped, meaning any type of
data can be inserted as a value.

What does it mean that JS arrays are dynamic? - Answer-It means they grow and shrink
as needed; there is no need to declare a fixed size.

What does it mean that JS arrays are sparse? - Answer-It means that the elements do
not have contiguous indexes from zero, but that there may be gaps.

What is the length property for sparse or nonsparse arrays? How does the index
number related to the length? - Answer-For non-sparse arrays, the length equals the
number of elements in the array. For sparse arrays, the length is larger than the index of
the elements because of empty indexes.

What is the construct for an array literal? - Answer-var empty = [];
An empty array.

, What is an array constructor? How could you add to array constructors? - Answer-var a
= new array();
Constructor array with no arguments.

var family = new Array();
family[0] = new Person("alice", 40);
family[1] = new Person("bob", 42);

In the construct var a = new array(45); what does the 45 stand for? - Answer-The
number of indexes the array should create. Additional arguments would specify the
values of the array.

Are all indexes property names? - Answer-Yes, but not all property names are indexes.
Only numbers between 0 - 2^32-2.

Other than assigning values to new indexes, how can elements of an array be created?
- Answer-array.push(); ---> adds one or more elements to the end of the array
array.unshift() ---> pushes an array value to the beginning of an array and shifting all
other values to a larger index

What happens if you delete a value from an array index? - Answer-That index becomes
sparse.

What code in a for loop would skip null, undefined, or nonexistent elements? - Answer-if
(!a[i]) continue;

What code in a for loop would skip undefined, or nonexistent elements? - Answer-if (a[i]
=== undefined) continue;

What code in a for loop would skip nonexistent elements? - Answer-(!(i in a)) continue;

How would you test for any inherited properties an array would have from its prototype
and filter them out? - Answer-if (!a.hasOwnProperty(i)) continue;
Which skips inherited properties

What is a heterogeneous array? - Answer-An array that is comprised of different types
of values: strings, numbers, and booleans

What is a jagged array? - Answer-An array that is composed of two or more arrays that
do not have the same number of values in their respective arrays

What is a multidimensional array? - Answer-An array that has one or more arrays
nested inside of it

Define array.join() - Answer-A method that converts all elements of an array to a string
and concatenates them returning the resulting string

Información del documento

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

¿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