From 649349a749e67217dfd69f4841172331d850721e Mon Sep 17 00:00:00 2001 From: cjmanetta & Daniel Shafer Date: Mon, 13 Jul 2015 15:58:55 -0700 Subject: [PATCH] nailed it as usual --- todo_list.js | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/todo_list.js b/todo_list.js index 110fce6..940f4f6 100644 --- a/todo_list.js +++ b/todo_list.js @@ -1,10 +1,41 @@ -var newTodoList = function() { - // ??? +function Task(id, description) { + this.id = id; + this.description = description; + this.completed = false; + + this.complete = function() { + this.completed = true; + }; +} + + +var TodoList = function() { + this.tasks = []; + var id = this.tasks.length + 1; + this.add = function(description) { + var a = new Task(id, description); + this.tasks.push(a); + id++; + }; + this.list = function() { + for(var i=0;i< this.tasks.length;i++) { + console.log(this.tasks[i].description); + } + }; + this.remove = function(i) { + delete this.tasks[i]; + }; }; +// // Driver code + +// var groceryList = new TodoList(1, 'cheese') + +// console.log(groceryList) + -// Driver code +// // Driver code -var todoList = newTodoList(); \ No newline at end of file +// var todoList = newTodoList();