angularjs find and update object in array

JavaScript
//$scope.customers is a list of customers
// o is a response of PUT request which will be return customer updated object
var x = $scope.customers.find(x => x._id === o.data.customer._id)
var index = $scope.customers.indexOf(x)
$scope.customers[index] = o.data.customer
Source

Also in JavaScript: