function mapDefiner(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const amountOfMaps = mapDefiner(10, 50);
function shotDefiner(min, max) {
let result = Math.floor(Math.random() * (max - min + 1)) + min;
return result;
}
var shotArray = [];
function shotsPerMap(){
for (let x = 0; x < amountOfMaps; x++) {
console.log (shotDefiner(1, 15));
}
}
console.log(shotsPerMap());

This prints random numbers based upon the results from the amountOfMaps RNG.
how do I push these results onto an array for further manipulation? For some reason I cannot get it to work whatever I am trying. Can someone help me?

There is a let called result in shotDefiner. I thought through this way I was able to push contents of result found in shotDefiner onto the array shotArray since the results were assigned to the let ‘result’

I know how that works. I am working on an RNG out of which all of the results are not known beforehand. I don’t have any results beforehand since they are randomized but I want to know how to push them onto the array shotArray in this case directly after they’ve been generated.

If you know how that works, then you should know that shotDefiner().result is nonsense. You are not returning an object with the result property. You are returning a number.

Parameters go into a function. They are not the output.

If you know what the return value of this function is and how return values work, then what you want is straightforward. If you don’t understand function calls and return values, then this is really hard.

function returnSomething(num) {
let returnValue = num * num;
return returnValue;
}
let returnedThing = returnSomething(5);