I have array and i need to write a function that accepts the name of the user and and boolean should be changed to true.
var array = [{
  user: "Sasha",
  message: "Hello guys",
  time: "20:28:2",
  read: false
}, {
  user: "Sasha",
  message: "How are you doing",
  time: "20:28:2",
  read: false
}, {
  user: "Dima",
  message: "I am fine, thanks!",
  time: "20:28:2",
  read: false
}, {
  user: "Katya",
  message: "I am doing well! What about you?",
  time: "20:28:2",
  read: false
}]
function readMessage(user) {
  let test = array
  let filtered = test.filter(item => item.user === user);
  let y = filtered.map(item => item.user && !item.read);
  console.log(y);
}
readMessage();I think i should filter array, and then change bool to the opposite, but after that map function returns only bools. How to change boolean and push changes to the original array?
 
     
     
     
    