Help i am stuck!

I was googling to understand better how .reduce works and i came across this code that i can’t understand:

var numbers = [15.5, 2.3, 1.1, 4.7];

function getSum(total, num) {
    return total + Math.round(num);
function myFunction(item) {
    document.getElementById("demo").innerHTML = numbers.reduce(getSum, 0);

How does the numbers var get passed to the function under it, how does the function getSum knows to take array from numbers variable? what if there was a second var array named numbers 2??
sorry for this silly question -_-
i busted my head to understand but i have no clue and didn’t knew how to search for it in google.

EDIT: never mind after posting the code i saw that it says numbers.reduce omg i looked the code for like 20 minutes and didn’t see it


That’s the weird thing about chaining in javascript. if you chain a method to an object, that method will accept the scope and invoke the function parameter using that scope as the parameter for the function parameter.