Advertisement
Guest User

Untitled

a guest
Aug 1st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var zoo = [
  2.   {type: "tyger", weight: 100, food: "meat", sound: "roar"},
  3.   {type: "lion", weight: 150, food: "meat"},
  4.   {type: "scimpanze", weight: 80, food: "vegetables"},
  5.   {type: "gorilla", weight: 150, food: "vegetables"},
  6.   {type: "panda", weight: 200, food: "all"},
  7.   {type: "grizzly", weight: 250, food: "all"},
  8. ]
  9.  
  10. //----------------------------------------------------------
  11.  
  12. var OnlyLightWeightMeatEaters = zoo
  13.  
  14. .filter((animal) => animal.food == "meat" && animal.weight <= 100 )
  15.  
  16. //.map((animal) => animal.type)
  17.  
  18. console.log(OnlyLightWeightMeatEaters)
  19.  
  20. //var { type, sound } = OnlyLightWeightMeatEaters
  21. var type = OnlyLightWeightMeatEaters.type
  22. var sound = OnlyLightWeightMeatEaters.sound
  23.  
  24. console.log(OnlyLightWeightMeatEaters)
  25.  
  26. console.log("The "+type+" says "+sound+" !")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement