-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasic_Functions_1.js
More file actions
127 lines (112 loc) · 1.71 KB
/
Basic_Functions_1.js
File metadata and controls
127 lines (112 loc) · 1.71 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
///PART ONE///
function a(){
return 35;
}
console.log(a());
//Outcome = 35
function a(){
return 4;
}
console.log(a()+a());
//Outcome = 8
function a(b){
return b;
}
console.log(a(2)+a(4));
//Outcome = 6
function a(b){
console.log(b);
return b*3;
}
console.log(a(3));
//Outcome = 9
function a(b){
return b*4;
console.log(b);
}
console.log(a(10));
//Outcome = 40
function a(b){
if(b<10) {
return 2;
}
else {
return 4;
}
console.log(b);
}
console.log(a(15));
//Outcome = 4
function a(b,c){
return b*c;
}
console.log(10,3);
console.log( a(3,10) );
//Outcome = 30
function a(b){
for(i=0; i<10; i++){
console.log(i);
}
return i;
}
console.log(3);
console.log(4);
//Outcome = 3,4
function a(){
for(i=0; i<10; i++){
i = i +2;
console.log(i);
}
}
a();
//Outcome = 2,5,8,11
function a(b,c){
for(i=b; i<c; i++) {
console.log(i);
}
return b*c;
}
a(0,10);
console.log(a(0,10));
//Outcome = 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0
function a(){
for(i=0; i<10; i++){
for(j=0; j<10; j++){
console.log(j);
}
console.log(i);
}
}
//Outcome = 0,1,2,3,4,5,6,7,8,9 (listed 9 times, 0 count increments with each set)
function a(){
for(i=0; i<10; i++){
for(j=0; j<10; j++){
console.log(i,j);
}
console.log(j,i);
}
//Outcome = 0,1,1,2,2,3,3,4,4,5,...etc
z = 10;
function a(){
z = 15;
console.log(z);
}
console.log(z);
//Outcome = 10
z = 10;
function a(){
z = 15;
console.log(z);
}
a();
console.log(z);
//Outcome = 15, 15
z = 10;
function a(){
z = 15;
console.log(z);
return z;
}
z = a();
console.log(z);
//Outcome = 15, 15