To answer this question, you need to understand how arrays are used in JavaScript.
An array is a special type of variable that can store multiple values in a single variable. It is created using square brackets [] and each value is separated by a comma.
Let's go through each option to understand which one uses arrays:
Option A) setTimeout("a["+i+"]",1000)
- This option uses an array. The a
variable is likely an array, and it is accessing the element at the index i
using square brackets.
Option B) k = a & i
- This option does not use arrays. It is using the bitwise AND operator (&) to perform a bitwise operation between variables a
and i
.
Option C) k = a(i)
- This option does not use arrays. It is using parentheses () to call a function named a
with the parameter i
.
The correct answer is option A. This option uses an array to access an element at a specific index.