Skip to content

Instantly share code, notes, and snippets.

@al-the-x
Created May 14, 2015 14:07
Show Gist options
  • Save al-the-x/add274685b675131dc2e to your computer and use it in GitHub Desktop.
Save al-the-x/add274685b675131dc2e to your computer and use it in GitHub Desktop.
(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);
(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