Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Counting Elements | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
JavaScript Essentials for Beginners - 1768407374405

bookChallenge: Counting Elements

Taak

Swipe to start coding

You are given an array called fruitBasket that contains several fruit names.

  1. Create a variable named numberOfFruits and assign it the length of the fruitBasket array.
  2. Use an if...else statement 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.
  3. Make sure you use the numberOfFruits variable in your console messages. Do not hardcode any numbers.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 64
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: 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.

  1. Create a variable named numberOfFruits and assign it the length of the fruitBasket array.
  2. Use an if...else statement 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.
  3. Make sure you use the numberOfFruits variable in your console messages. Do not hardcode any numbers.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 64
single

single

some-alt