Closed odv closed 4 years ago
In my app I've named everything with an 's' at the end : 'todos', ' addTodos' and so on. Are you talking about these ones or new ones?
'addTodo' should add objects where? And how many?
'changeTodo should change the todoText property' you mean change the 'todos' list which is an array containing strings to something else?
'toggleCompleted should change the completed property' what property? Change it into what?
let toDoApp = {
todos: [],
displayTodos: function() {
console.log(`mytodos:${this.todos}`);
},
addTodos: function(input) {
this.todos.push({
todoText: input,
completed: false
});
this.displayTodos();
},
changeTodos: function(output, position) {
this.todos[position].todoText = output;
this.displayTodos();
},
toggleCompleted: function(pos) {
this.todos[pos].completed = !this.todos[pos].completed;
this.displayTodos();
},
deleteTodos: function(element) {
this.todos.splice(element, 1);
this.displayTodos();
},
deleteAllTodos: function() {
this.todos = [];
this.displayTodos();
}
};
[x] addTodos should add objects
[x] changeTodo should change the todoText property
[x] toggleCompleted should change the completed property