Heres my code:
var birdColor = getColumn(“100 Birds of the World”, “Primary Color”);
var conservationStatus = getColumn(“100 Birds of the World”, “Conservation Status”);
var birdName = getColumn(“100 Birds of the World”, “Name”);
var filteredRandomizedBirdList = ;//Global variable, these will be choices from the dropdown
var colorChoice = “Black”;
var statusChoice = “Least Concern”;function filter(){
var index = 0;
var color = birdColor;
var status = conservationStatus;
for(i = 0; i < birdColor.length; i++){
if(color[i] === colorChoice && status[i] === statusChoice){
filteredRandomizedBirdList = birdName[i];
index = randomNumber(0, filteredRandomizedBirdList.length -1);
console.log(filteredRandomizedBirdList[index]);
setText(“textArea”, filteredRandomizedBirdList);
}
}
}filter();
I think its something with my loop here. Basically I want to get 2 pieces of into from a dropdown and then display the name of any bird that has those 2 pieces of info, but I want to pick a random bird. Right now using console log I am getting first letters of random birds I assume?
Project Link: App Lab - Code.org