-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathq34.ts
More file actions
22 lines (17 loc) · 1.19 KB
/
q34.ts
File metadata and controls
22 lines (17 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Pizzas: Think of at least three kinds of your favorite pizza. Store these pizza names in a array, and then use a for loop to print the name of each pizza.
// • Modify your for loop to print a sentence using the name of the pizza instead of printing just the name of the pizza. For each pizza you should have one line of output containing a simple statement like I like pepperoni pizza.
// • Add a line at the end of your program, outside the for loop, that states how much you like pizza. The output should consist of three or more lines about the kinds of pizza you like and then an additional sentence, such as I really love pizza!
export default function q34(){
const pizzas:string[] = ['Margherita', 'Pepperoni', 'Hawaiian'];
// for (let i = 0; i < pizzas.length; i++) {
// console.log(`I like ${pizzas[i]} pizza.`);
// }
pizzas.forEach(function(pizza){
console.log(`I like ${pizza} pizza`);
})
console.log("\nPizza is my favorite food.");
console.log("I could eat it every day and never get tired of it.");
console.log("There's just something about the combination of bread, cheese, and tomato sauce that makes it irresistible.");
console.log("I really love pizza!");
}
q34();