forked from ZTJones/JSDojang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
132 lines (85 loc) · 2.97 KB
/
test.js
File metadata and controls
132 lines (85 loc) · 2.97 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
/*
..................................................
: ...... :
: .:||||||||:. :
: / \ :
: ( o o ) :
:-------@@@@----------: :----------@@@@---------:
: `--' :
: :
: :
: K I L R O Y S A Y S H I ! :
:................................................:
*/
// yo - says dbristol
// I see you David.
// I know! So maybe you should MOD this discussion! </hint> 😂
// Let's look into modulos next time, I've got a feeling it's going to come in handy. :)
// Given an array/list of numbers, replace numbers divisble by 3 with Fizz, replace numbers divisible by 5 with Buzz, and replace numbers divisible by both with FIZZBUZZ
let basicList = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
let movieList = ["Jaws", "Friday the 13th", "KPAX", "Airplane!", "Avatar", "The Fifth Element"];
// this should be solved as [0, 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, FIZZBUZZ];
function fizzBuzz(numList){
// Insert cool code here
// console.log(numList);
// loop - iterate, or scan through, all of the elements of input array/list.
for(let i = 0; i < numList.length; i++){
// in here.
console.log(numList[i]);
// here
}
// conditional - if statement, switch statements
if(numList[0] == 0){
}
// return FizzBuzzList;
}
fizzBuzz(basicList);
// Recursion is fun!
function fizzBuzzRec(numList){ // a recursive version
// fizzBuzzRec( info, more info);
}
// Hello world testing area
//Jeff - Test If/Else Loop
// for (let i= 0; i<16 ; i++ ){
// if (condition)
// {
// i/3= //A Whole Number
// //Then replace number with "Fizz"
// if (condition)
// i/5= //A Whole Number
// //Then replace number with "FIZZBUZZ"
// } else
// {
// // Return i
// }
// }
// Varialbles, conditionals (if, else), Loops! (for, while)
// Next dictionaries, arrays/lists, functions
// After this point, define a variable to hold your name
// True or false? Boolean
let quickBool;
// let quickBool = true;
quickBool = true;
const movementSpeed = 5; // const means constant. It means that this never changes.
// String
let dania = "dania";
// Integers
let a = 2;
let b = 3;
let c = a + b;
let Cool = "Zach";
console.log (Cool);
if( Cool == "Zach"){
console.log("Zach is the best!");
} else {
console.log(Cool + " is the best! Zach is not though.");
}
while(Cool == "Zach")
{
console.log("Help, I'm stuck in a loop, and everything is bad.");
Cool = "Joseph";
}
for(let i = 0; i < 100; i++)
{
console.log(i);
}