-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
146 lines (97 loc) · 4.3 KB
/
index.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<html>
<head>
<title>Ok Coders JS1 Quiz</title>
</head>
</html>
<body>
<script>
// ----- Fundamentals
// assign 5 to a variable called age
// what is the value of this: true && true
// what is the value of this: true && false
// what is the value of this: true || true
// what is the value of this: false || true
// what is the value of this: false && false
// write something that checks whether the variable below is greater than or equal to 5, and if it is prints, "the number is greater than or equal 5"
var number = 8
// now also check to see if it is less than or equal to 0, and print "the number is less than or equal to 0"
// now, if it is not greater than 5, and not less than 0, print, "your number is between 0 and 5"
// ---- Functions
// what will the output of the below program be
// var name = "Zach"
// function printName() {
// var name = "Bob"
// console.log(name)
// }
// printName()
// console.log(name)
// what will the output of the below program be
// var name = "Zach"
// function printName(name) {
// console.log(name)
// }
// printName()
// console.log(name)
// what will the output of the below program be
// var name = "Zach"
// function printName(name) {
// console.log(name)
// }
// printName("Bob")
// console.log(name)
// what will the output of the below program be
// function printName(name) {
// name
// }
// console.log(printName)
// what will the output of the below program be
// function printName(name) {
// name
// }
// console.log(printName("Bob"))
// what will the output of the below program be
// function printName(name) {
// return name
// }
// console.log(printName("Bob") + " Rockers")
// ----- Arrays
var arrayExample = ["foo", "bar", "baz"]
// add one item of your choice to the end of array
// remove the last item from the array
// remove the second item from the array
// write something that will console log each element in the array
// write something with will console log each element in the array with the text: "here is the <nth> element, its value is: <value>", replacing the <> items with the proper value
// take your if greater than or equal to 5, less than or equal to 0, etc. logic from above, and write something that will run that test on each of the numbers below
var numbers = [5, 8, 42, 34, 58, 2, -4, 7]
// what is the sum of the numbers in the numbers array (write a program to give back the answer)
// ----- Objects
var objectExample = { firstName: "Bertrand", lastName: "Russell", age: 42 }
// console.log the age property of the object
// console.log the firstName property of the object
// add a new property to the object called occupation, and give it a value of your choice, for example (Philosopher)
// write a function called fullName that takes the object, and returns a string with the firstName and lastName properties combined together
// ----- Arrays with Objects
var arrayWithObjectsExample = [{ name: "Zach", age: 5, address: { zip: 73106 } }, { name: "Bob", age: 4, address: { zip: 73103 } }]
// write something that will console.log the name value of each object in the array
// write something that will console.log the zip value inside the address of each object in the array
// write something that will print the name property of each element in the above array if the age property is greater than 4
// ----- Dom/Page manipulation
// write an html file that will prompt the user and ask for their age, save that in a var called userAge
// instead of prompting the user for their age, get it though a text input field, and add a button so they can submit. When they submit, console.log the value they provided
// instead of console.logging their age, on the screen below the input after they hit submit, add this text: "You were <age> in 1999"
// With <age> being the person's age in the year 1999
// ----- Bonus
// write a function called log each, that will take an array of elements, and log each element in the array to the console
// what is happenining in this function
var a = 1
var b = 2
function combine(a, b) {
b++
return a + b
}
function log(stuff) {
console.log("Here is what you wanted me to log: ", stuff)
}
log(a + b + combine(a, b))
</script>
</body>