WARNING

Are you sure you want to reset the challenge? You'll lose all changes you've made to the code.

Reassigning Array Values

We can also use index notation to reassign values in a array. For example, say you want to change the element at index 2:

let list ["Dog", "Cat", "Bird", "Fish"];
list[2] = "Turtle";
list // ["Dog", "Cat", "Turtle", "Fish"]

Tests

Write a function named topSecret. It should take two inputs (in this order):

  • an array
  • an index

It should return the same array, but the element at the input index should be replaced with the string "CLASSIFIED".