数组indexOf方法

var the_arr = [
                {"id":1,"name":"Tom"},
                {"id":2,"name":"Cathy"},
                {"id":3,"name":"Jack"}];

var the_obj  = the_arr[1]; 
var the_obj_ = {"id":1,"name":"Tom"};



console.log(the_arr.indexOf(the_obj));   //return  1
console.log(the_arr.indexOf(the_obj_));  //return -1

 

posted @ 2018-03-05 15:19  lee_oy  阅读(345)  评论(0编辑  收藏  举报