From 250ef5643118b414b8ddbeb5043620dab47a4762 Mon Sep 17 00:00:00 2001 From: baileyfaircloth-ctrl Date: Sat, 18 Oct 2025 16:02:24 -0400 Subject: [PATCH] Update script.js --- script.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/script.js b/script.js index 0f65e5b..8488017 100644 --- a/script.js +++ b/script.js @@ -57,3 +57,25 @@ let friendFavorites = [ // 10. STRETCH: Find the longest food name and print: // "The longest food name in the list is ______ with ___ characters." + +// 1. Create arrays +const fruits = ['apple', 'banana', 'orange']; +const veggies = ['carrot', 'broccoli', 'spinach']; + +// 2. Loop through and log +for (let fruit of fruits) { + console.log(fruit); +} + +// 3. Function with parameter +function favoriteFood(food) { + console.log(`My favorite food is ${food}!`); +} +favoriteFood('pizza'); + +// 4. Conditional example +if (fruits.length > veggies.length) { + console.log('More fruits than veggies!'); +} else { + console.log('More veggies than fruits!'); +}