I attempted to replicate the map() method by writing this code in order to double each number in the array. However, I am puzzled as to why the output is 5 without logging it to the console. Moreover, whenever I run the code again, it mysteriously keeps adding 5 to a variable that I never defined?
const numbers = [1, 2, 3, 4, 5];
const doubleNumbers = [];
for (let i = 0; i < numbers.length; i += 1) {
doubleNumbers.push(numbers[i] * 2)
}