Dropdown menu in javascript not working

Hi I’ve created a webmap and dropdown function to get the features. Sometimes i get the dropdown features correctly but sometimes i dont get.

Iam sharing screenshots of my problem

As you can see, in the Second image it is picking up 5 values correctly, in the first image even they are 3 values it is picking up single value.

Any ideas to solve this issue would greatly appreciated
Thank you!!