Challenge: Counting Elements
Taak
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.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 64
single
Vraag AI
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.
Geweldig!
Completion tarief verbeterd naar 1.33
Challenge: Counting Elements
Veeg om het menu te tonen
Taak
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.
Oplossing
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 1. Hoofdstuk 64
single