Challenge: Counting Elements
Tehtävä
Swipe to start coding
You are given an array called fruitBasket that contains several fruit names.
- Create a variable named
numberOfFruitsand assign it the length of thefruitBasketarray. - Use an
if...elsestatement to:- Print
"We have a small fruit basket with [number] fruits!"if there are 3 or fewer fruits. - Print
"We have a big fruit basket with [number] fruits!"if there are more than 3 fruits.
- Print
- Make sure you use the
numberOfFruitsvariable in your console messages. Do not hardcode any numbers.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 64
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Mahtavaa!
Completion arvosana parantunut arvoon 1.33
Challenge: Counting Elements
Pyyhkäise näyttääksesi valikon
Tehtävä
Swipe to start coding
You are given an array called fruitBasket that contains several fruit names.
- Create a variable named
numberOfFruitsand assign it the length of thefruitBasketarray. - Use an
if...elsestatement to:- Print
"We have a small fruit basket with [number] fruits!"if there are 3 or fewer fruits. - Print
"We have a big fruit basket with [number] fruits!"if there are more than 3 fruits.
- Print
- Make sure you use the
numberOfFruitsvariable in your console messages. Do not hardcode any numbers.
Ratkaisu
Oliko kaikki selvää?
Kiitos palautteestasi!
Osio 1. Luku 64
single