JavaScript根据Id取出数组中指定的对象

var obj=arr.find(function (obj) {
    return obj.id === 3
})

arr为包含对象的数组,取出的obj是数组arr中一个id为3的对象