closures || map method || arguments || map method how internally works

var map = function(arr, fn) {
    let n=arr.length;
    let arr2=[];
    for(let i=0;i<n;i++){
//here we can call this function with 0 || 1 || 2 no of arguments
        arr2.push(fn(arr[i],i));
    }
    return arr2;

};

function arguments behavior in javaScript

we can pass any no of arguments in the javaScript function as it is loosely typed

If a user created a function using some arguments 1..2..3..or any no of arguments they can create

While calling the function we can pass any number of arguments as per our need. Here we can assign any default value also as per our need We can achieve this using If else, logical &&, ||

We also can do anything using the arguments link as it is present on every object

how to pass unlimited arguments in a function || method in javaScript

If we use the spread operator ... then it accepts unlimited parameters and this argument is stored in an array. and we can do operations in whatever array methods are available

function unlimitedArguments(...args){
//here the args is array and stored the passes values 
//it can be anything i mean string , number, char,or any other data type
var x=args.length;
console.log(x);
}
unlimitedArguments(1,2,3,5,4);