I'm trying to take a user's prompt to find the index position of an item in an array and retrieve the value of that same index position in a second array.
var arrayStars = ["Polaris", "Aldebaran", "Deneb", "Vega", "Altair", "Dubhe", "Regulus"];
var arrayConstellations = ["Ursa Minor", "Taurus", "Cygnus", "Lyra", "Aquila", "Ursa Minor", "Leo"];
function starSearch(param) {
var matchingConstellation = arrayConstellations[arrayStars.indexOf("param")];
return matchingConstellation;
}
var userInput = prompt("Enter a star name");
starSearch(userInput);
When I enter text in the prompt there is no response.
I've tried logging to the console after every line to see what output there is if any and it all seems to work but for some reason it doesn't give the intended result.
I've even replaced one of the array values into the line
var matchingConstellation = arrayConstellations[arrayStars.indexOf("Vega")];
And that returns the proper index item from the second array. It just doesn't seem to display a result when everything is together.