Issue
I have the problem that I need to find which of the letters in the alphabet is true and which is false.
I can't change the array $available (comes from a response).
indexOf does not work because it looks only at the index values 0 & 1 but it have to look at the values...
any idea how to fix that?
Here my pseudo code:
var $alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
var $available = [0: 'a', 1: 'b'];
var $templateglossar = [];
angular.forEach($available, function(letter) {
if($alphabet.indexOf(letter) > -1) {
$templateglossar.push(letter => true);
} else {
$templateglossar.push(letter => false);
}
});
Solution
There are two possible solutions for your issue.
1:
if($alphabet.indexOf($available[letter]) > -1)
2:
angular.forEach($available, function(key, letter) {...});
Answered By - alex kucksdorf
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.