Are you ready?

1 questions to solve.

Instructions
  1. This quiz goes to full-screen once you press the Start button, or any Next button after exiting the quiz window.
  2. At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
Arrays can be created using the:
Both methods create an array in JavaScript. For more info please check out Creating arrays in JavaScript.
How to access the second element of the array arr = [3, 7, 10]?
Array indexes start at 0 - the first element is at index 0, the second is at index 1 and so on and so forth. To access the second element, we'll use bracket notation along with the index 1. This goes with choice D).

For more information, refer to JavaScript Arrays Introduction.
Arrays can have arrays as elements.
True or false?
In JavaScript, arrays can definitely contain arrays and if this is the case, we have the concept of array dimensions into the game. More info on Array Dimensions.
Define a 2D array.
For more information on array dimensions please refer to Arrays Basic Concepts.
What would arr.indexOf(0) and arr.indexOf(1) return respectively, if arr holds the array [1, 5, 8]?
indexOf() gives the index of a given value (if found) in the array.
Which property on arrays can be used to loop through them?
length gives the total number of elements in an array which can then be used to loop through it.
How to replace the second element in the array arr = [1, 7, 9] with the value 8?
Array indexes start at 0. Hence the second element would be at index 1. For more info on the basics of the basics of arrays head over to Creating Arrays.
The expressions arr[0] and arr.shift() do the same thing on a given array. Yes or no?
arr[0] returns the element at position 0 and arr.shift() removes the first element from the array and returns it.
What does new Array(10) return?
i is 5 hence i < 5 is false and thus the loop won't procede any further.
What is the value of passed in the following code?
var marks = [30, 35, 42, 20, 15];
var passed = marks.every(function(m) {
    return m > 40;
});
every returns true or false based on whether every element in the array meets a given condition or not.
Can we check for an array using the typeof operator? If not then why?
To check for arrays in JavaScript we can't rely on typeof because it returns "object" for both array and pure objects! See Arrays Basic Concepts for more details.
What will the following code log?
var arr = [1, 66, 20];
arr.length = 0;

console.log(arr[0]);
Setting the length property of an array to a given value reduces (or expands) the array to that very length. In this case, the expression arr.length = 0 makes arr equal to [], on which arr[0] logs undefined. This goes with choice (C).
What will the following code log?
var arr = [10, 50, 88];
arr.filter(function(e) {
    return e > 10;
});

console.log(arr);
Line 2 here returns the array [50, 88], which simply has no consequence. arr is nonetheless still the same, as filter() doesn't work on the original array. Likewise line 6 returns [10, 50, 88] - the same old value of arr - which goes with choice A).