In ES6 you can use Array.prototype.find(predicate, thisArg?)
like so:
array.find(x => x.name === 'string 1')
http://exploringjs.com/es6/ch_arrays.html#_searching-for-array-elements
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find
To then replace said object (and use another cool ES6 method fill
) you could do something like:
let obj = array.find(x => x.name === 'string 1');
let index = array.indexOf(obj);
array.fill(obj.name='some new string', index, index++);