Complete the code to access the element at index 2 in the array.
const arr = [10, 20, 30, 40]; const value = arr[[1]]; console.log(value);
The index 2 accesses the third element in the array, which is 30.
Complete the code to update the element at index 1 to 50.
const arr = [10, 20, 30]; arr[[1]] = 50; console.log(arr);
Index 1 refers to the second element, which is updated to 50.
Fix the error in the code to correctly update the last element of the array.
const arr = [5, 10, 15]; arr[[1]] = 20; console.log(arr);
The last element is at index 2 because array indexes start at 0.
Fill both blanks to access and update the element at index 0 to 100.
const arr = [1, 2, 3]; arr[[1]] = [2]; console.log(arr);
Index 0 accesses the first element, which is updated to 100.
Fill all three blanks to access the element at index 2, update it to 75, and then print the updated array.
const arr = [10, 20, 30, 40]; arr[[1]] = [2]; console.log([3]);
Index 2 accesses the third element, which is updated to 75, then the array is printed.
