ITEC 102 FINAL TERM Quiz No 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

The first element in every array.

index 0

The methods used to fill the specified static values by modifying original values in the given array.

fill()

The easiest way to create an array in JavaScript.

Array Literal

The includes() method returns the first index (position) of a specified value.

False

The methods that concatenates (joins) two or more arrays.

concat()

The methods used to add elements at the beginning of the array.

unshift()

The slice() method removes the first item of an array.

False

An array that can be created using the new keyword which passing arguments in a constructor.

Array Constructor

The every() method returns true if the function returns false for all elements.

False

The reverse() method reverses the order of the elements in an array.

True
The methods used to combine the array elements into the string and provides a new string.

join()

The concat() method returns a new array, containing the joined arrays.

True

An array that can be created using the new keyword,

Array Directly

It defines as an ordered list of values and also a container object that holds a fixed number of values of a
single type.

array

The methods that removes the last element of an array.

pop()

Each item in an array is called an _____________ that can be accessed by its numerical index.

element

An array is used to store a collection set, but it is often more helpful to consider an array as a set of the
same type of variables.

True

The methods used to add elements at the end of the array.

push()

The sort() sorts the elements as strings in descending order.

False
The forEach () method is used to invoke the function for each array element.

True

A keyword that is used to create instance of array.

new keyword

The _______________ of an array is established when the array is created. After creation, it is fixed.

length

var x = [1,3,5,8,2,-5,-8];
var temp = x[x.length-1];
x[x.length-1] = x[0];
x[0] = temp;
console.log(x);

[-8,3,5,8,2,-5,1]

var x = [];
for(var i = 0; i<10; i++) {
x.push(i*2);
}
console.log(x);

[0,2,4,6,8,10,12,14,16,18]

var x = [2,4,5];
var counter = 0;

if(x[counter] > 0) {
console.log("coding");
counter = counter + 1;
}
if(x[counter] > 0) {
console.log("coding");
counter = counter + 1;
}
if(x[counter] > 0) {
console.log("coding");
counter = counter + 1;
}
console.log(x);
console.log(counter);

coding,coding,coding,[2,4,5],3

var x = [1,3,5];
x.push(2);
x.pop();
console.log(x);

[1,3,5]

You might also like