Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Challenge: Searching for Animals in the Zoo | Exploring Arrays
Introduction to JavaScript

Scorri per mostrare il menu

book
Challenge: Searching for Animals in the Zoo

Compito

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:

js

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 5. Capitolo 11
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?

Chieda ad AI

expand
ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

book
Challenge: Searching for Animals in the Zoo

Compito

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:

js

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 5. Capitolo 11
Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?
some-alt