This is a simple JavaScript script that generates a herd of cows and a flock of chickens. It randomly assigns names, colors, and ages to each animal and then describes them.
The script generates a herd of cows by randomly selecting names, colors, and ages from predefined lists. Each cow is then instantiated with these attributes and added to the herd.
Similarly, the script also generates a flock of chickens using predefined lists of names, colors, and ages. Each chicken is instantiated with these attributes and added to the flock.
To run the script, simply execute the main
function. This will generate the cow herd and chicken flock and display their descriptions in the console.
- A black cow, 8 years old, named Bessie.
- A brown cow, 6 years old, named Spot.
- A white cow, 10 years old, named Daisy.
- A white chicken, 12 months old, named Penny.
- A brown chicken, 8 months old, named Nugget.
- A black chicken, 18 months old, named Cluck Cluck.
This script is for demonstration purposes and can be customized further as needed.