Advertisement
Didart

Animal Type

Mar 12th, 2022
1,102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function animalType(input) {
  2.     let type = input[0];
  3.  
  4.     switch (type) {
  5.         case "dog":
  6.             console.log("mammal");
  7.             break;
  8.         case "crocodile":
  9.         case "tortoise":
  10.         case "snake":
  11.             console.log("reptile");
  12.             break;  
  13.         default:
  14.             console.log("unknown");
  15.             break;
  16.     }
  17. }
  18. animalType(["dog"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement