Day 13 : Postman Challenge - Script to count the species having avg height > 100

Can someone please help me with the script to count the number of species whose average height is greater than 100 from the response body of this request

This is how the response look for single species and continue further
“count”: 37,
“next”: “”,
“previous”: null,
“results”: [
“name”: “Human”,
“classification”: “mammal”,
“designation”: “sentient”,
“average_height”: “180”,
“skin_colors”: “caucasian, black, asian, hispanic”,
“hair_colors”: “blonde, brown, black, red”,
“eye_colors”: “brown, blue, green, hazel, grey, amber”,
“average_lifespan”: “120”,
“homeworld”: “”,
“language”: “Galactic Basic”,
“people”: [”,”,”,
“films”: [”,”,”,”,”,
“created”: “2014-12-10T13:52:11.567000Z”,
“edited”: “2014-12-20T21:36:42.136000Z”,
“url”: “

@sabbyk Welcome to the community :partying_face:

I can give some hints here:

  1. If you are new to JS, try traditional for loop to looping through the entire response, and you need to add a conditional statement inside to check the “average_height>100”
  2. Create an array and push the count if the it satisfies the conditional statement above.

Please try and share the scripts, then we will try to help debug it :blush:

Thank you so much @bpricilla for your help. I did complete that challenge using your hints.

1 Like