奇怪的骨干findWhere()行为

Mat*_*son 5 javascript json backbone.js

我正在使用Backbone和RequireJS构建一个应用程序,我对Collection.findWhere()Backbone功能的行为感到非常困惑.

代码是这样的:

var myId = 1;
var subList = parentList.findWhere({id: myId});
Run Code Online (Sandbox Code Playgroud)

subList显示为undefined.

代码是这样的:

var subList = parentList.findWhere({id: 1});
Run Code Online (Sandbox Code Playgroud)

subList包含正确的模型.

有谁知道这可能导致什么?