-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
92 lines (74 loc) · 1.46 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
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
//this is a ingle line comment
//
/* this
* is
* a
* multi line
* comment
* */
var a = 3;
var b = 2;
var c = a + b;
console.log('this is a string');
console.log(a);
console.log(b);
console.log(c);
var first = "sally";
var last = "smith";
var fullName = first + " " + last ;
console.log(first)
console.log(last)
console.log(fullName)
var d = Math.pow(2,8)
console.log('2^8 =', d);
a = 3;
b = 4;
var c = 5;
var d =6;
var e = Math.pow(( (a+b)/(b-c)) * ((b-a)/(c-d)),(b+a));
console.log(e);
/* Branching with if/else statements */
var age = 20;
if(age >= 21){
console.log("You are legal to drink")
}else{
console.log("You are not legal to drink")
}
// this is the maximum allowed rating you can see
if(age >= 0 && age <= 5){
console.log("You can see a G rated movie")
}else if(age < 13){
console.log("PG Rated")
}else if(age <= 13){
console.log("PG-13 Rated")
}else if(age === 17){
console.log("R Rated")
}else if(age === 18){
console.log("NC-17")
}else{console.log("X rated")}
var color = 'blue';
switch(color){
case 'blue':
console.log('i see blue');
break;
case 'red':
console.log('i see red');
break;
case 'orange':
console.log('i see orange');
break;
case 'green':
console.log('i see green');
break;
default:
console.log('that is not a valid color')}
a = 1
while(a < 10){
console.log('a is looping...', a);
// a++;
// a = a + 1
a += 2;
}
for(var i = 0; i < 10; i++){
console.log('1 ===', i)
}