This is my first question at stackoverflow, i hope someone can help me
var filters = {
all: function (todos) {
return todos
},
active: function (todos) {
return todos.filter(function (todo) {
return !todo.completed
})
},
completed: function (todos) {
return todos.filter(function (todo) {
return todo.completed
})
}
}
filteredTodos: function () {
return filters[this.visibility](this.todos)
},
Why can this "filters [this.visibility](this.todos)" use I used to be alert () so Not used alert [] () like this please help me
filters[this.visibility]is not a function call, it's a property being accessed using Bracket notation - the resulting property is a function, hence the(this.todos)invocation at the end