-
Notifications
You must be signed in to change notification settings - Fork 0
/
Task1a.js
47 lines (41 loc) · 1.27 KB
/
Task1a.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// How do I run this script?
// In the terminal folder with Task1a.ts
// node Task1a.js
// type: string[]
const todoList = [];
/**
* YOUR OBJECTIVE:
* Suppose there are some tasks you want to work on during your first week at Yale.
* Write a procedure that adds the 3 below TODOS on line 18, represented as strings,
* to the TodoList array defined on line 7. Then, print the TodoList in a
* nice, readable way.
*
* Only modify the file under the "// YOUR CODE HERE" comments.
*
* TODOS:
* 1. Apply to y/cs!
* 2. Pick out my classes
* 3. Have dinner with my suite
*
*/
function addAndPrintTodos() {
// YOUR CODE HERE
todoList.push("Apply to y/cs!")
todoList.push("Pick out my classes")
todoList.push("Have dinner with my suite")
console.log(todoList)
}
/**
* Main is considered the entry point to a procedural program. Within y/cs,
* it's rare for us to write procedures in JS, but for learning purposes
* we do it here
*/
function mainTask1a() {
addAndPrintTodos()
}
// This bit of code ensures that a main method exists! If it doesn't, then it throws an error
if (require.main === module) {
// unlike other languages like Java, there is no built in main method. We use a funciton called
// main by convention.
mainTask1a();
}