array.find()方法
//array.find(function(currentValue, index, arr),thisValue) 方法说明
let tempArray = [
{"key":100,"key2":"sdfsdf"},
{"key":210,"key2":"dfgdg"},
{"key":310,"key2":"sdfsdfbh"},
];
this.tempValue = 210;
let result = tempArray.find(function (item) {
return item.key == this.tempValue;
},this);
cc.log('---log--- gmk result' + jsonencode(result));
//---log--- gmk result{"key":210,"key2":"dfgdg"}