FrontendDeveloper.in

Vue.js question detail

What are the array detection non-mutation methods?

The methods which do not mutate the original array but always return a new array are called non-mutation methods.

Below are the list of non-mutation methods,

  1. filter()
  2. concat()
  3. slice()
  4. map()
  5. reduce()
  6. find()
  7. includes()
  8. every()
  9. some()
  10. indexOf()
  11. join()

For example, lets take a todo list where it replaces the old array with new one based on status filter,

vm.todos = vm.todos.filter(function (todo) {
return todo.status.match(/Completed/)
})

This approach won't re-render the entire list due to VueJS implementation.

Back to all Vue.js questions
Get LinkedIn Premium at Rs 399