-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJavaScript Practice 1.js
More file actions
101 lines (76 loc) · 2.33 KB
/
JavaScript Practice 1.js
File metadata and controls
101 lines (76 loc) · 2.33 KB
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
var d= new Date();
document.getElementById("alfa").innerHTML=d;
function greetFunction () {
var hour = new Date().getHours();
var greeting;
if (hour<18){
greeting = "Good Day!";
}
else {
greeting = "Good Evening!";
}
alert(greeting);
}
greetFunction();
var text;
switch (new Date().getMonth()){
case 11:
case 0:
case 1:
text = "It must be freezing outside...";
break;
case 2:
case 3:
case 4:
text = "It must be really nice outside!";
break;
case 5:
case 6:
case 7:
text = "Boy, you should get a cold drink...";
break;
case 8:
case 9:
case 10:
text = "... not again! I hate this time of year...";
}
document.getElementById("beta").innerHTML= text;
var cars = ["Mercedes", "BMW", "Porche", "Citroen", "Peugeot", "Fiat", "GM", "Wolkswagen", "Ford", "Lincoln"];
function listCars(){
var text = " ";
var i;
for ( i=0; i<cars.length; i++ ){
text += cars[i] + "<br>";
document.getElementById("gama").innerHTML= text;
}
}
function listCars_Red(){
var carsRed = cars;
carsRed = cars.slice(5);
document.getElementById("epsilon").innerHTML= carsRed;
}
function listCars_Black(){
var text = " ";
var i;
var textCarsBlack = text;
for ( i=0; i<cars.length; i++ ){
if (i===5){break;}
textCarsBlack += cars[i] + "<br>";
document.getElementById("delta").innerHTML= textCarsBlack;
}
}
function listCars_German(){
var text = " ";
var i;
for ( i=0; i<cars.length; i++ ){
if (i===3 || i===4 || i===5 || i===6){continue;}
if (i===8){break;}
text += cars[i] + "<br>";
document.getElementById("zeta").innerHTML= text;
}
}
// function HandleUserInput () {
// console.log("UserInputHandled");
// alert("UserInput: " + document.getElementById("userinput").value.toLowerCase());
// }
// HandleUserInput();