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

Stryg for at vise menuen

book
Challenge: Searching for Animals in the Zoo

Opgave

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

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 5. Kapitel 11

Spørg AI

expand
ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

book
Challenge: Searching for Animals in the Zoo

Opgave

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

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 5. Kapitel 11
Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Vi beklager, at noget gik galt. Hvad skete der?
some-alt