-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathscript.js
More file actions
59 lines (24 loc) · 1.85 KB
/
script.js
File metadata and controls
59 lines (24 loc) · 1.85 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
console.log("Hello World!");
// 1. Create an array called favoriteFoods with at least 6 foods you love.
// 2. Loop through the list and print: "One of my favorite foods is ______."
// 3. Print out the rating for each food with a ranking like:
// "My #1 favorite food is Ramen" (copy/paste for all items)
// "My #2 favorite food is Sushi"
// ...etc.
// 4a. Create a function printFoodRecommendation(foodName) that prints out the following for the foodName provided
// "Have you ever tried ____?"
// "I always recommend ____ to friends."
// "Trust me — ____ is delicious."
// 4b. Call the function at least 3 times
// Here's a list of 50 friends' favorite foods:
let friendFavorites = [
"Pizza", "Sushi", "Pasta", "Falafel", "Burgers", "Ramen", "Pad Thai", "Curry", "Pho", "Nachos", "Gnocchi", "Donuts", "Steak", "Lasagna", "Biryani", "Tacos", "Croissant", "Churros", "Fried Rice", "Shawarma", "Miso Soup", "BBQ Ribs", "Hotpot", "Enchiladas", "Baklava", "Gyros", "Hummus", "Empanadas", "Pancakes", "Muffins", "Samosas", "Macarons", "Quiche", "Pierogi", "Arepas", "Okonomiyaki", "Ceviche", "Brisket", "Bao Buns", "Poutine", "Clam Chowder", "Fajitas", "Canelé", "Kimchi", "Tamales", "Omelette", "Biscuits", "Tempura", "Spring Rolls", "Crepes"
];
// 5. Print out only foods that have an "a" in the name. For example, "Pizza" would not be included, but "Donuts" would be.
// 6. Store the result in an array called foodsWithA. Print out the array.
// 7. Create a new array longFoodNames for foods with names longer than 6 characters.
// 8. Create another array shortFoodNames for foods 6 characters or shorter.
// 9. Print both arrays and compare:
// "There are more long-named foods." OR "There are more short-named foods."
// 10. STRETCH: Find the longest food name and print:
// "The longest food name in the list is ______ with ___ characters."