-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpg16.js
145 lines (129 loc) · 2.22 KB
/
pg16.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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
var setting = function(){
var myNumber = 42;
var myName = "Chetan";
var temp = myName;
myName = myNumber;
myNumber = temp;
};
var print52 = function(){
for(var i = -52; i<=1066; i++){
console.log(i);
};
};
var beCheerful = function(){
for(var i = 0; i<98; i++){
console.log("Be Happy");
};
};
var multOfThree = function(){
var counter = -300;
while(counter<0){
if(counter%3==0){
if(counter == -3 || counter == -6){
continue;
};
console.log(counter);
};
counter++;
};
};
var printWhile = function(){
var count = 2000;
while(count < 5281){
console.log(count);
count++;
};
};
var birthday = function(day, month){
if((day == 31 && month == 10) || (day == 10 && month == 31)){
console.log("How did you know!");
}
else{
console.log("Just another day...");
};
};
var leapYear = function(year){
if(year%400 == 0){
return true;
}
else if(year%100 == 0){
return false;
}
else if(year%4 == 0){
return true;
}
else{
return false;
};
};
var printAndCount = function(){
var counter = 0;
for(var i = 512; i<=4096; i++){
if(i%5==0){
console.log(i);
counter++;
};
};
console.log(i);
};
var multOfSix = function(){
//consider incrementing by 6 every time instead of by 1 and then checking value. (bonus question..)
for(var i = 0; i<=60000; i++){
if(i%6==0){
console.log(i);
};
};
};
var dojoCount = function(){
for(var i = 1; i <=100; i++){
if(i%10==0){
console.log("Coding Dojo");
}
else if(i%5==0){
console.log("Coding");
}
else{
console.log(i);
};
};
};
var whatDoYouKnow = function(value){
console.log(value);
};
var hugeNumber = function(){
//shortcut is that the answer is 0...
var count = -300000;
var sum = 0;
while(count<=300000){
sum += count;
count++;
}
console.log(sum);
};
var countdownByFour = function(){
var start = 2016;
while(start>0){
if(start%4==0){
console.log(start);
};
start--;
};
};
var flexibleMult = function(low, high, mult){
var runner = high;
while(runner>low){
if(runner%mult==0){
console.log(runner);
};
};
};
var theFinalCountdown = function(param1, param2, param3, param4){
for(var i = param2; i<=param3; i++){
if(i%param1==0){
if(i==param4){
continue;
};
console.log(i);
};
};
};