Which of the following best describes an array in JavaScript?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following methods can be used to add elements to the end of an array in JavaScript?
Which of the following methods can be used to remove the last element from an array in JavaScript?
Which of the following methods can be used to determine the number of elements in an array?
What will be the output of the following code?
var arr = [1, 2, 3, 4, 5];
console.log(arr[2]);
What will be the output of the following code?
var arr = [1, 2, 3, 4, 5];
console.log(arr.length);
What will be the output of the following code?
var arr = [1, 2, 3];
arr.push(4);
console.log(arr.length);
What will be the output of the following code?
var arr = [1, 2, 3];
arr.pop();
console.log(arr.length);
What will be the output of the following code?
var arr = [1, 2, 3];
arr.unshift(0);
console.log(arr);
Which of the following methods can be used to remove the first element from an array in JavaScript?
What is the output of the following code?
var arr = [1, 2, 3, 4, 5];
arr.splice(2, 1);
console.log(arr);
What is the output of the following code?
var arr = [1, 2, 3, 4, 5];
var newArr = arr.slice(2);
console.log(newArr);
What is the output of the following code?
var arr = [1, 2, 3];
console.log(arr.indexOf(3));
What is the output of the following code?
var arr = [1, 2, 3, 4, 5];
arr.forEach(function(element) {
console.log(element * 2);
});