I have confused about dynamic parameter function from another file, compare with normal function. for example :
1. Normal Function
function foo() {
let arr=[]
for (var i = 0; i < arguments.length; i++) {
arr.push(arguments[i]);
}
console.log(arr.length)
}
foo('aa','bb') ==> output 2 -> Correct
2. Function from another file
*otherFunc.js
module.exports = {
running: () => {
let arr = []
for (var i = 0; i < arguments.length; i++) {
arr.push(arguments[i]);
}
console.log(arr.length)
}
}
*tes.js
var db = require('./otherfunc');
db.running('aa','bb') ==> output 5 -> Not Correct
Why output two function is difference? how to solve this? thank you