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
Introduction to JavaScript

bookChallenge: Searching for Animals in the Zoo

Task

Swipe to start coding

Use the includes method to check if certain animals are in a list.

  • Write three if-else conditions to check if the following animals are in the animalsInZoo array: Lion, Zebra, Panda.
  • If the animal is in the zoo, print: "Yay! We have a [animal] in our zoo!", where [animal] is the name of the animal.
  • If the animal is not in the zoo, print: "Oh no! No [animal] in our zoo today.".

As stated in the instructions, you will need three separate pairs of if-else conditions:

if(...) {
  // code
} else {
  // code
}

if(...) {
  // code
} else {
  // code
}

if(...) {
  // code
} else {
  // code
}

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

Awesome!

Completion rate improved to 1.33

bookChallenge: Searching for Animals in the Zoo

Swipe to show menu

Task

Swipe to start coding

Use the includes method to check if certain animals are in a list.

  • Write three if-else conditions to check if the following animals are in the animalsInZoo array: Lion, Zebra, Panda.
  • If the animal is in the zoo, print: "Yay! We have a [animal] in our zoo!", where [animal] is the name of the animal.
  • If the animal is not in the zoo, print: "Oh no! No [animal] in our zoo today.".

As stated in the instructions, you will need three separate pairs of if-else conditions:

if(...) {
  // code
} else {
  // code
}

if(...) {
  // code
} else {
  // code
}

if(...) {
  // code
} else {
  // code
}

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!

close

Awesome!

Completion rate improved to 1.33
SectionΒ 5. ChapterΒ 11
single

single

some-alt