I'm trying to compare two variables and find out if they have the same position to display the second variable, I'm trying to find out the second variable (Artist name) based off of the first input which was the Track Name, based off of the position on the data table.
All the track names are on the same position as the artist who made the song so I want to be able to display that when they input it.
My Code so far to choose the track name based off of a drop down with all 200 songs.
onEvent("fighter1", "change", function( ) {
var Track = getProperty("fighter1", "text");
setProperty("songLabel_1", "text", "");
var ChosenTrack = Track.substring (0,100);
var TrackName = getColumn("Spotify Charts: Top 200 Artist and Song", "Track");
for (var i = 0; i < TrackName.length; i++) {
if (ChosenTrack == TrackName) {
}
setProperty("songLabel_1", "text", ChosenTrack);
}
});
How would I structure it so that when the Track chosen pulls up its corresponding artist and displays it on a different label?
I'm using Code.org to program this.