在下面的示例数组中,查找“foo”的所有可能值的最佳(或最快)方法是什么。
var table = [
{foo: 0, bar:"htns", stuff:123},
{foo: 2, bar:"snhn", stuff:156},
{foo: 5, bar:"trltw", stuff:45},
{foo: 5, bar:"lrctm", stuff:564},
//few thousand lines later
{foo: 2596, bar:"cns", stuff:321},
{foo: 2597, bar:"gcrl", stuff:741}
];