Arrays do not have toLowerCase
(note that your code has a typo: missing function r
). But you can use the function map
and return string values. It works as follows:
["Foo", "BaR"].map(function (c) { return c.toLowerCase(); });
In your code, this can be applied as shown below:
if($scope.diseaseList.map(function (c) {
return c.toLowerCase();
}).indexOf(_list[i].disease.toLowerCase()) != -1) { ... }
, != -1
, :
if(~$scope.diseaseList.map(function (c) {
return c.toLowerCase();
}).indexOf(_list[i].disease.toLowerCase())) { ... }
@Tushar :
String.prototype.toLowerCase.apply(arr).split(',');