Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "Why should a sum over a possibly empty array usually pass 0 to reduce?" on CodeWiki (https://codewiki.com/practice/mcq/javascript/array-methods/reduce-empty-input/).
Context (verbatim from the page):
"""
Why should a sum over a possibly empty array usually pass 0 to reduce?
It defines the empty result and prevents reduce from throwing on an empty array.
It makes reduce mutate the array in place.
It makes the callback run twice for every value.
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in JavaScript. Where you are unsure, say so.