Created
May 14, 2015 14:07
-
-
Save al-the-x/add274685b675131dc2e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(function (window) { // IIFE: Immediately Invoked Function Expression | |
'use strict'; // For bonus points, what does this do? | |
var list = [ ]; | |
console.log(list); | |
todos.addTaskToList("Remember the milk", list); | |
console.log(list); | |
})(window); |
This file contains hidden or 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
(function (window){ | |
var taskList = []; | |
// I can list my tasks... | |
function listTasks(list){ | |
// TODO: make this do something... | |
} | |
//I can add a task to my list... | |
function addTaskToList(task, list){ | |
//What is the task? | |
//Where is the task going? | |
//What order / priority? | |
return list.push(task); | |
} | |
//I can check a task off my list... | |
function completeTask(task, list){ | |
return list[task - 1] += ' COMPLETE'; | |
} | |
//I can delete a task off my list... | |
function deleteTask(task, list){ | |
return list.splice(task - 1, 1); | |
} | |
window.todos = { | |
"addTaskToList": addTaskToList, | |
"completeTask": completeTask, | |
"deleteTask": deleteTask | |
}; | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment