-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathForForFor.js
More file actions
141 lines (96 loc) · 2.64 KB
/
ForForFor.js
File metadata and controls
141 lines (96 loc) · 2.64 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// We're going to use for loops here.
// write a for loops that prints out all the numbers from 1 to 100. (Or logs it at least);
// for(let y=1;y<101;y++){
// console.log(y);
// }
// let x = 1
// for
let blah = 1;
// while(true)
// {
// if(blah < 101)
// {
// console.log(blah);
// blah++;
// }
// else
// {
// break;
// }
// // This function leaves the game
// }
// var statusCount = 1;
// do{
// statusCount = getStatus();
// console.log(statusCount);
// }while (statusCount <= 100)
// function getStatus()
// {
// //get the remote status of the thing.
// }
// do{
// // We do this stuff first
// }while(true); // Then we check and see if the stuff in parenthesis is "true".
// Sweet, sweet freedom.
// function pollingTest(){
// console.log("Hello world, this is 5 seconds apart");
// }
// for(let i = 1; i > 0; i++){
// console.log(i); // ??????
// }
// while(true)
// {
// setTimeout(test => {
// console.log("Hello world, this is 5 seconds apart");
// }, 5000);
// }
// setInterval // This is what I was thinking about David.
// let counter = 0;
// let intervalID = setInterval(() => {
// console.log("This happens every 5 seconds");
// counter++;
// }, 5000);
// new Promise(r => setTimeout(window.clearInterval(intervalID), 10000))
// .catch(console.log('SOMETHING went wrong.'));
// console.log("test");
// await new Promise(r => {setTimeout(r=2000)})
// var dog = "dog";
// function test() {
// var dog = "Not dog";
// }
let char = 'c';
let char2 = 'k';
let stringTest = "Hello World!";
// Given a string, print all the letters out individually.
// loop
// console.log
// for(let i = stringTest.length - 1; i >= 0; i--){
// console.log(stringTest[i]);
// }
// let holderString = "";
// for(let i = stringTest.length - 1; i >= 0; i--){
// holderString += stringTest[i];
// }
// console.log(holderString);
// given a string, reverse the string, then output the result using console.log
let holder;
for(let i = 0; i < stringTest.length / 2; i++){
console.log("Loop is running");
holder = stringTest[i];
// console.log(stringTest[(stringTest.length - 1) - i]);
// console.log(stringTest[i]);
stringTest[i] = stringTest[(stringTest.length - 1) - i];
stringTest[(stringTest.length - 1) - i] = holder;
// console.log(holder);
console.log(stringTest);
}
console.log(stringTest);
function maybeThisWorks(str){
let holder;
for(let i = 0; i < str.length / 2; i++){
console.log("Loop is running");
// str.
}
console.log(str);
}
// maybeThisWorks(stringTest);