forked from bravo-2018/Assessments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Week-1.js
35 lines (22 loc) · 1.19 KB
/
Week-1.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
// 1. Look at this if statement... something about it doesn't really make sense. Change it so that the messages make sense.
if(true) {
console.log("You'll never see this message!")
} else {
console.log("This message is visible")
}
// 2. Create a for loop that counts to 10 backwards. Comment each line to explain what is happening.
for( ) {
// your code here
}
// 3. Create an array with at least 4 items inside it. Console.log the second thing in the list. Change the fourth item to equal "duck".
// 4. Being comfortable with if/else decisions is very helpful in code. It helps you get into the practice of breaking complex actions down into their simpler parts. You might recognize this example:
if(!tired) {
keepWorking()
} else {
console.log("I need coffee!")
}
// Now try to come up with your own if/else decision - if you can't think of one, try to create one for opening a door.
// 5. Time to combine all this! Create a function that takes in two numbers as arguements. Find the sum of those two numbers, if the sum is less than 20, console log the sum. If the two numbers sum to more than 20, console log "can't count that high!"
function practiceFunc(arg1, arg2) {
// your code here
}