so I have an Array and I want to loop through the Array and check if the values in it match some strings and if so do something.
This is what I have so far:
var rgt_count = a_related_genres_leon.length; // <- 3 items
for (var i = 0; i < rgt_count; i++) {
if inArray("Music", a_related_genres_leon) {
console.log('Music');
} else if inArray("TV", a_related_genres_leon) {
console.log('TV');
} else if inArray("Comedy", a_related_genres_leon) {
console.log('Comedy');
}
}
I'm getting a Uncaught SyntaxError: Unexpected token ( error right now.
I also tried this
if text($.inArray("Music", a_related_genres_leon)) {
console.log('Music');
} else if text($.inArray("TV", a_related_genres_leon)) {
console.log('TV');
} else if text($.inArray("Comedy", a_related_genres_leon)) {
console.log('Comedy');
}
if
clause is different in JavaScript. – VisioN Apr 26 at 17:24