I have a java script and I want to have a function which takes a parameter and execute different function that amount of times.
I have something like that for now:
<body onLoad="funct1(5)">
<script>
funct1(a){
var house = [];
int x = 20;
int y = 250;
for(var i= 0; i<a; i++){
house [i] = funct2(x,y);
y=y+50;
}
for (var j = 0; j<a; j++){
house[j]();
}
}
</script>
<script>
funct2(x,y){
//doing something with that 2 variables, drawing a house.
}
</script>
I was trying to put that 2 functions in one script but it also didn't work. Is there is any possible way to execute one function from another and put it into an array to store it and to draw it afterwards?