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

bookChallenge: Searching for Animals in the Zoo

Tâche

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

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 66
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Searching for Animals in the Zoo

Glissez pour afficher le menu

Tâche

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 desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 66
single

single

some-alt