You forgot to return a result from the point, where you entering recusrion.
var users = [23, 23, 23, 23, 23, 23, 23, 23, 23, 23];
console.log(Check(users, 0, 20));
function Check(ids, counter, limit){
ids.push(23);
// Recursion
if (counter+1 < limit){
return Check(ids, counter+1, limit); // return here!
}
else {
console.log(ids);
return ids;
}
}
But return value seems useless, cause' your function altering initial array as well.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…