forked from lighthouse-labs/todo-list-js-exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (21 loc) · 669 Bytes
/
index.js
File metadata and controls
26 lines (21 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function newTask(title, description) {
const task = {
title: title,
description: description,
complete: false,
logState: function() {
console.log(`${this.title} has${this.complete ? " " : " not "}been completed`);
},
markCompleted: function() {
this.complete = true;
}
};
return task;
}
// DRIVER CODE CHANGES BELOW
const task1 = newTask("Clean Cat Litter", "Take all the 💩 out of the litter box");
const task2 = newTask("Do Laundry", "😨");
const tasks = [task1, task2];
task1.logState(); // Clean Cat Litter has not been completed
task1.markCompleted();
task1.logState(); // Clean Cat Litter has been completed