todo => completed === todo.completed这是什么写法
ES6的箭头函数,需要好好看了哦。
function (todo) { return completed === todo.completed ; }
箭头函数
相当于:
function (todo) {
return completed === todo.completed
}
语法糖
相当于:
todos.filter(function(todo){
return completed === todo.completed
})