Home Why doing someVar in someArray in an If always give false value
 I was just working on something in AngularJS. I noticed that by using the attached style of if condition, I always get a false result. Why so? Am I missing something? I tried to google it but didn't find anything. var myApp = angular.module('myApp',[]); function MyCtrl($scope) { var allowedExtensions = [".jpg",".pdf", ".png"]; var testExt = ".jpg"; if(testExt in allowedExtensions){$scope.isAllowed = true; }else{ //will always go here why? \$scope.isAllowed = false; } } 
 I am from .NET background so we use LINQ in that kinda same like that. Is this type of syntax not supported in JS? EDIT I know about index of and other ways to find if it is in the array. But I was confused why in operator is not working. Thank you for your time and help.