我从咕噜我JSHint一个错误,它沿行云:使用AngularJS foreach循环与JsHint和EQ操作
line 48 col 23 Expected '===' and instead saw '=='.
“===”打破了代码。
我有谷歌周围,显然禁用此被打破的选项(使用最新版本4日,2014年9月)
我的代码都这样:
$scope.getStationById = function(stationId)
{
var parsedId = stationId,
foundStation;
angular.forEach($scope.stations, function(station)
{
if(station.id == parsedId)
{
foundStation = station;
}
});
return foundStation;
};
如何任何建议我可以沉默这个恼人的错误?
编辑
的控制台登录:
console.log(station.id + " | " + parsedId);
产地:
1 | 1
3 | 1
5 | 1
检查两个操作数的类型。他们不能是一样的。 – elclanrs 2014-09-04 05:22:47
添加以下日志语句,并告诉输出是什么,console.log(typeof station.id); console.log(typeof parseId)。我认为一个是字符串,其他是数字 – coder 2014-09-04 05:25:57