Created
September 18, 2017 13:53
-
-
Save imparvez/bbcab8a0cefcb854cf7ef127f39d2c2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// V3 Objects | |
// It should store the todos arrays on an object | |
// It should have a display todos method | |
// It should have an addTodo method | |
// It should have a changeTodo method | |
// It should have a deleteTodo method | |
var todoList = { | |
todos: ['item 1', 'item 2', 'item 3'], // 1. It should store the todos arrays on an object | |
displayTodos: function(){ | |
console.log('My Todos: ', this.todos) | |
}, | |
addTodos: function(newTodo){ | |
this.todos.push(newTodo); | |
this.displayTodos(); | |
}, | |
changeTodo: function(pos, newTodo) { | |
this.todos[pos] = newTodo; | |
this.displayTodos(); | |
}, | |
deleteTodo: function(pos) { | |
this.todos.splice(pos, 1); | |
this.displayTodos(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment