1D0-720 · Question #55
Which statement is true about JavaScript arrays?
The correct answer is B. Arrays are used to store multiple values in a single variable. JavaScript arrays are designed to store multiple values in a single variable, making B correct - you can collect items like names, numbers, or objects all under one identifier (e.g., const items = [1, "hello", true]). A is wrong because JavaScript arrays are dynamically typed…
Question
Which statement is true about JavaScript arrays?
Options
- AArrays in JavaScript can only store elements of the same type.
- BArrays are used to store multiple values in a single variable.
- CArrays in JavaScript are fixed in size once declared.
- DJavaScript does not support array methods like push() or pop().
How the community answered
(51 responses)- A4% (2)
- B94% (48)
- D2% (1)
Explanation
JavaScript arrays are designed to store multiple values in a single variable, making B correct - you can collect items like names, numbers, or objects all under one identifier (e.g., const items = [1, "hello", true]). A is wrong because JavaScript arrays are dynamically typed and can hold mixed types in the same array. C is wrong because JavaScript arrays are dynamic in size - you can add or remove elements at any time without declaring a size upfront. D is wrong because JavaScript has a rich set of built-in array methods including push(), pop(), map(), filter(), and many more.
Memory tip: Think of a JavaScript array as a flexible shopping bag - it can hold anything (any type), you can always add more items or remove them (dynamic size), and it comes with built-in tools to manage what's inside (array methods).
Topics
Community Discussion
No community discussion yet for this question.