Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var zoo = [
- {type: "tyger", weight: 100, food: "meat", sound: "roar"},
- {type: "lion", weight: 150, food: "meat"},
- {type: "scimpanze", weight: 80, food: "vegetables"},
- {type: "gorilla", weight: 150, food: "vegetables"},
- {type: "panda", weight: 200, food: "all"},
- {type: "grizzly", weight: 250, food: "all"},
- ]
- //----------------------------------------------------------
- var OnlyLightWeightMeatEaters = zoo
- .filter((animal) => animal.food == "meat" && animal.weight <= 100 )
- //.map((animal) => animal.type)
- console.log(OnlyLightWeightMeatEaters)
- //var { type, sound } = OnlyLightWeightMeatEaters
- var type = OnlyLightWeightMeatEaters.type
- var sound = OnlyLightWeightMeatEaters.sound
- console.log(OnlyLightWeightMeatEaters)
- console.log("The "+type+" says "+sound+" !")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement