The problem of passing parameters to function closures in JavaScript!

this function dim is intended to create an array of specific length (d), incrementing by 1 from a specific digital (n).

question 1: why is the first bit of the returned array always the parameter passed in at the beginning? Shouldn"t I PP?
question 2: I don"t quite understand the concept of closure. Please explain why adding n parameters to the function in line 6 and 7 will cause an exception (I think the parameter should be imported into the following parameter)
for example, if I pass n into the function in the sixth line, he won"t start to increase according to the number I specified. Instead,
with a return value starting from 0: (10) [0,1,2,3,4,5,6,7,8,9]

function ontology:

Array.dim = function(d, n){
    var i,
        a = []
        //n = n + 1;
    for (i = 0; i < d; iPP){
        a[i] = (function (){  //n
            return function(){  //n
                return nPP
            }()
        })(i)
    }
    return a
}

var arr = Array.dim(10,2);
console.log(arr)  //(10)[2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
Apr.13,2021

question 1: the first bit of the returned array is the parameter passed at the beginning. At this time, n plus 1 becomes 3pp return, and it is 2pp return. So it is 2. This is the difference between pre-self-increment and post-self-increment.
question 2: passing n in the function in the sixth line is equivalent to defining a formal parameter n for this function. When Array.dim (1010), at the beginning, iCo0, pass the parameter I outside, It is equivalent to passing a value of 0 to the formal parameter n of this function, so it is returned from (10) [0,1,2,3,4,5,6,7,8,9]

for (i = 0; i < d; iPP){
    a[i] = (function (n){ //n
            console.log(n) //0
                return function(){  
                return nPP
                }()
              })(i)//n0
}

passing n in the function in the seventh line is equivalent to defining a formal parameter n, so if the value is undefined,undefinedPP, it is NaN

.
for (i = 0; i < d; iPP){
    a[i] = (function (){ 
                return function(n){  //n
                console.log(n) //undefined
                return nPP
                }()
              })()
}

this question does not need to import the parameters n and I. After the function runs, it is found that if there are no variables n and I, it will automatically go up along the scope, and get iMagol
Array.dim = function (d, n) {

.
var i,
    a = []
    // n = n + 1;
for (i = 0; i < d; iPP){
    a[i] = (function (){ 
                return function(){ 
                return PPn
                }()
              })()
}
return a

}

var arr = Array.dim (10Power2);
console.log (arr) / / return (10) [3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e959-4dac2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e959-4dac2.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?