I have an array of objects like this one.
var books = [{
id : 1,
name : 'Name of the wind',
year : 2015,
rating : 4.5,
author : 2}];
Now I have a function editBooks which asks user for an id and replaces the book with same id with the values given by the user. For example
function editBooks(name,author,year,rating,id)
How can i replace the contents of objects inside my books array based on id provided by the user?