A simple Node.js CLI script to create and interact with speaking animals.
This project consists of a set of animal classes, including Cat, Dog, Cow, and Unicorn, each with its unique speaking behavior. The script allows you to create animals by specifying their name and type through the command line.
Before running the script, ensure you have Node.js installed on your machine. You can download it from https://nodejs.org/.
- Clone or download the project repository to your local machine
- Navigate to the project directory
- Install the project dependencies with
npm install
To create and interact with animals, use the following command-line syntax:
node Animal.js <name> <type> [favoriteFood]
Replace <name>
with the desired name of the animal and <type>
with the type of animal you want to create (e.g., cat, dog, cow, unicorn). [favoriteFood]
is an optional argument with a default value of "treats".
node Animal.js Bean cat
This command will create a cat named "Bean" and the following output:
Bean says "Meow" 😸
cats enjoy eating treats
- If an unknown animal type is provided, the script will display a message indicating valid animal types.
- Use
npm test
to run Jest unit tests.