-
Notifications
You must be signed in to change notification settings - Fork 2
/
arrays.html
59 lines (31 loc) · 860 Bytes
/
arrays.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
<script>
//Exercise 1:
//Print the type of any string and the type of any array
//Expected Input:
//Exercise 1:
//Print the element of the array ['apple','banana','pear','watermelon']
//Expected Input 1:
//0
//Expected Output 1:
//apple
//Expected Input 2:
//2
//Expected Output 2:
//pear
//Type your code below:
function fruit_basket(n) {
fruits = ['apple','banana','pear','watermelon']
return fruits[n]
}
console.log(fruit_basket(0))
//console.log(fruits[0]);
//FINISH THIS LATER!!!!!!!!!!!!!!!!1
//Print the last element of an array without manually counting how many elements there are
//Example code
//console.log(fruits[fruits.length - 1]);
//Exercise 3
//Join the elements Red,Blue,Green into one string with no space and print them
myColor = ["Red","Blue","Green"];
//Example code
console.log(myColor.join());
</script>