I have a small todo app here: http://jsfiddle.net/ccLm46sn/
Two arrays, one contains completed tasks, the other archived tasks.
Whenever I execute the function archiveCompleted I want all completed tasks to be pushed on to the array with the archived tasks and the completed array then deleted.
Something like this:
this.tasks.archived.push({ this.tasks.current.filter(function(task) { return task.completed; }); }); But it does not work.
This here works fine, by overwriting the archived array with the completed array:
this.tasks.archived = this.tasks.current.filter(function(task) { return task.completed; }); But I don't want to overwrite the archived array, just to push into that:
Here is the fiddle: http://jsfiddle.net/ccLm46sn/