Array Quiz Question 20

Does delete_at method change the original array? I think it does, but the answer says it does not…

It definitely does David, great catch! Where is this mentioned exactly in the curriculum? I will get it corrected.

a = [1, 2, 3]
a.delete_at 1
=> [1, 3]

alpha-curriculum -> Arrays -> Array Quiz ->
arr = [1,2,3]
20. What is the value of arr at the end of the above code snippet?
The “correct” answer now is [1, 2].

After arr.delete(3), the value of arr is [1, 2] because the delete method is dangerous for arrays. Although arr.delete_at(0) returns 1 (indicating that the invocation successfully deleted the element 1 at the index 0), the delete_at method is not dangerous and the value of arr therefore does not change.

This is still a problem. I just took the array quiz and the last question, 20, still requires the wrong answer to pass.

This quiz has been updated to reflect the latest changes to the JumpStart curriculum and now only has 11 questions. Thanks again for the feedback!