-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJS002.html
More file actions
58 lines (53 loc) · 1.8 KB
/
JS002.html
File metadata and controls
58 lines (53 loc) · 1.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>More Stuff</title>
</head>
<body>
<h5>Welcome with the Deals Please</h5>
<script>
//Color Variations
var colors=['black','red','green','yellow'];
var sele=colors[2];
switch(sele){
case "black": console.log("The color is Black"); break;
case "red": console.log("The color is Red"); break;
case "green": console.log("The color is Green"); break;
}
//LOOPS.
for(var i=0; i<10;i++){
console.log(i);
console.log(colors[i]);
}
let animals=['Dog','Cow','Sheep','Donkey','Sheep'];
for(let i=0;i<animals.length;i++){
console.log(animals[i]);
}
var x=0;
while(x<10){
console.log(x);
x++;
}
var a=10;
while(a>=2){
console.log(a);
a--;
}
//String representation
var Data ="Username:";
console.log(Data);
var x=Data.toLowerCase();
console.log(x);
//Challenge One
var foods =['Shawarma','Chicken Biriani','Drum Stick','Beans and Ugali'];
var myString ="My Best food is ";
console.log(`${myString} ${foods[0]}`);
console.log("The Previously Input Data in the Array are the Following");
for(var i=0; i<foods.length;i++){
console.log(foods[i]);
}
</script>
</body>
</html>