Quiz: JavaScript Arrays

Test your JavaScript skills with this comprehensive MCQ quiz on arrays, covering array creation, methods, search, sorting, and best practices.

1.

Which of the following best describes a JavaScript array?

2.

What will be the result of the following code?

javascript
1
2
3
const animals = ["Cat", "Dog", "Bird"];
animals[0] = "Fish";
console.log(animals);
3.

Which method would convert an array into a comma-separated string?

4.

Which method returns the index of the first match of an item in an array?

5.

What is the output of the following code?

javascript
1
2
3
const numbers = [5, 10, 1];
numbers.sort((a, b) => a - b);
console.log(numbers);