-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq35.ts
More file actions
23 lines (16 loc) · 901 Bytes
/
q35.ts
File metadata and controls
23 lines (16 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Animals: Think of at least three different animals that have a common characteristic. Store the names of these animals in a list, and then use a for loop to print out the name of each animal.
// • Modify your program to print a statement about each animal, such as A dog would make a great pet.
// • Add a line at the end of your program stating what these animals have in common. You could print a sentence such as Any of these animals would make a great pet!
export default function q35(){
const animals: string[] = ["Dogs", "Cats", "Rabbits"];
animals.forEach(function(animal: string) {
console.log(animal);
});
console.log("");
animals.forEach((animal: string) => {
console.log(`A ${animal.toLowerCase()} would make a great pet.`);
});
console.log("They are all common household pets.");
console.log("Any of these animals would make a great pet!");
}
q35();