-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpro29.ts
27 lines (22 loc) · 958 Bytes
/
pro29.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*Favorite Fruit: Make a array of Ir favorite fruits, and then write a series of independent
if statements that check for certain fruits in your array.
• Make a array of your three favorite fruits and call it favorite_fruits.
• Write five if statements. Each should check whether a certain kind of fruit is in your array.
If the fruit is in your array, the if block should print a statement, such as You really like bananas!
*/
let favorite_fruits: string[] =["apple","mango", "banana"];
if (favorite_fruits.includes("apple")) {
console.log("I really like apple!");
}
if (favorite_fruits.includes("mango")) {
console.log("I really like mango!");
}
if (favorite_fruits.includes("banana")) {
console.log("I really like banana!");
}
if (favorite_fruits.includes("litchi")) {
console.log("I really like litchi!");
}
if (favorite_fruits.includes("stawberry")) {
console.log("I really like strawberry");
}