Hello, I am working on a simple game and I need to define an array of 126 sheep and during the game I can use only these sheep. Add them to the players farms etc.
But there are only 126 sheep.
How to define the initial array? Thank You for Your help.
var sheepInTheBox
Hubert
How about using a for-loop?
var sheepInTheBox = [];
for (let i = 0; i < 126; i++) {
let sheep = ...; // whatever the sheep value is
sheepInTheBox.push(sheep);
}
1 Like
hmm Finally I have done it just like that - “var sheepInTheBox = 120;” . When I make “sheepInTheBox–” than I take sheep from the box and when if I make “sheepInTheBox++” than I add sheep to the box. Thank You any way