forked from junior-devleague/functions-scavenger-hunt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
61 lines (39 loc) · 1.42 KB
/
app.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
58
59
60
61
var a = 24;
var b = 9;
var hour = 60;
var quarter = 4;
var array = [2,4,5,199,39,12,1];
var count = 9;
var car = {
wheels: 4,
passengers: 4,
mileage: 20300,
cost: 49928
}
var spaceship = {
wheels: 18,
rooms: 21,
passengers: 29909394895803589193049389,
cost: 0
}
var objectArray = [car, spaceship];
//PART I
//Function 1
//Create a function that adds variables a and b, then divides them by 11.
//Function 2
//Create a function that will console.log a value of 18.
//Function 3
//Create a function that will console.log the last element of the array by accessing the value from the array.
//Function 4
//Create a function that can divide hours by quarters, then add 10 to that result.
//Function 5
//Create a function that will multiply the 2nd and 3rd element from the array, then subtract 5 from that result.
//Function 6
//Create a function that will subtract the number of car wheels from the number of spaceship wheels.
//PART II
//Function 7
//Create a function and using a for loop, iterate through the array. In this loop, increment the count of the variable count.
//Function 8
//Create a function and using a for loop, iterate through the objectArray. In this loop, increment the count of the passengers for the 1st element in the objectArray.
//Function 9
//Create a function that adds the 1st and 6th element of the array.