Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Searching for Animals in the Zoo | Exploring Arrays
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to JavaScript

bookChallenge: Searching for Animals in the Zoo

Task

Swipe to start coding

You are given an array called animalsInZoo:

["Lion", "Tiger", "Elephant", "Giraffe", "Panda"]

Your tasks:

  • Write three separate if...else conditions to check whether the following animals exist in the zoo: "Lion", "Zebra", "Panda"
  • For each animal:
    • If it exists, return: "Yay! We have a [animal] in our zoo!"
    • If it does not exist, return: "Oh no! No [animal] in our zoo today."
  • Return all three messages inside an array in the same order.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 11
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Searching for Animals in the Zoo

Swipe to show menu

Task

Swipe to start coding

You are given an array called animalsInZoo:

["Lion", "Tiger", "Elephant", "Giraffe", "Panda"]

Your tasks:

  • Write three separate if...else conditions to check whether the following animals exist in the zoo: "Lion", "Zebra", "Panda"
  • For each animal:
    • If it exists, return: "Yay! We have a [animal] in our zoo!"
    • If it does not exist, return: "Oh no! No [animal] in our zoo today."
  • Return all three messages inside an array in the same order.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 11
single

single

some-alt