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

bookChallenge: Counting Elements

Tehtävä

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.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 64
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

close

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

  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.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 64
single

single

some-alt