-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
57 lines (41 loc) · 1.44 KB
/
script.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
48
49
50
51
52
53
54
55
56
57
// question 1
// Declare a variable called firstVar but don't initialise it with a value.
// your answer for question 1 goes here
var firstVar;
// question 2
// Declare a variable called name and assign it your first name.
// your answer for question 2 goes here
var name = "Tor";
// question 3
// Declare and initialise a variable with a number value.
// your answer for question 3 goes here
var number = 5;
// question 4
// Create a variable called division and initialise it with a value of 20 divided by 5.
// your answer for question 4 goes here
var divison = 20 / 5;
// question 5
// Write code that checks the type of the value "frog".
// your answer for question 5 goes here
var animal = "frog";
console.log(typeof animal);
// or just
console.log(typeof "frog");
// question 6
// Declare and initialise a variable called orderHasShipped with a boolean value.
// your answer for question 6 goes here
var orderHasShipped = true;
// question 7
// Create an if statement that checks if orderHasShipped is true. If it is true, console log the string value "true". If not, console log the string value "false".
// your answer for question 7 goes here
if (orderHasShipped === true) {
console.log("true");
} else {
console.log("false");
}
// question 8
// Create a for loop that counts from 0 to 9. Console log the value of the counter variable inside the loop.
// your answer for question 8 goes here
for (var i = 0; i <= 9; i++) {
console.log(i);
}