Hi Guys,
I am trying to write some JS to run a todo list, heres what I have got.
var todoList = {
todos:["item1","item2","item3"],
displayList: function(){
console.log(this.todos);
},
addTodo: function(todo){
this.todos.push(todo);
this.displayList();
},
changeTodo: function(position, newValue){
this.todos[position] = newValue;
this.displayList();
}
};
Whenever I try and call changeTodo in console it returns “changeTodo is undefined”
Everything else seems to work fine, I feel like I am overlooking something really obvious, or is there something I am failing to understand?