I'm trying to create 20 functions stored in variables. Each one adds a specific amount of numbers to another quantity. Here's an example:
function creaSuma(x){
return function(y){
return x + y;
}
}
for(let i=1; i<21; i++){
add+1=creaSuma(i); //this doesn't work. How would you change it?
}
In this case:
console.log(add15(10));
the output should be 25
So, how would I create those 20 variables without creating an array? (I tried it and it works) Thank you, it is just out of curiosity.