Skip to content

Commit 9799f7d

Browse files
committed
pushing multiple studios
1 parent e483393 commit 9799f7d

File tree

7 files changed

+89
-16
lines changed

7 files changed

+89
-16
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
.DS_Store
1+
.DS_Store
2+
**/node_modules

arrays/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data-and-variables/exercises/data-and-variables-exercises.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@
1010

1111
// Print the results of the trip to the moon below
1212

13-
let shuttleName = "Determination";
14-
let shuttleSpeedMph = 17500;
15-
let distanceToMarsKm = 225000000;
16-
let distanceToMoonKm = 384400;
17-
let milesToKm = 0.621;
18-
19-
console.log (typeof shuttleName)
20-
console.log (typeof shuttleSpeedMph)
21-
console.log (typeof distanceToMarsKm)
22-
console.log (typeof distanceToMoonKm)
23-
console.log (typeof milesToKm)
24-
25-
console.log ("test")
13+
14+
15+
let num = 4;
16+
17+
if (num % 2 === 0) {
18+
if (num % 2 === 1) {
19+
console.log("odd");
20+
}
21+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let num = 7;
2+
3+
if (num % 2 === 0) {
4+
console.log("EVEN");
5+
6+
if (num > 0) {
7+
console.log("POSITIVE");
8+
}
9+
}

functions/studio/studio-functions.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
//We want to COMPLETELY reverse an array by flipping the order of the entries AND flipping the order of characters in each element.
22

33
// Part One: Reverse Characters
4+
function reverseCharacters(stringToReverse){
5+
return stringToReverse.split('').reverse().join('')
6+
}
47

58
// 1. Define the function as reverseCharacters. Give it one parameter, which will be the string to reverse.
69
// 2. Within the function, split the string into an array, then reverse the array.
710
// 3. Use join to create the reversed string and return that string from the function.
811
// 4. Below the function, define and initialize a variable to hold a string.
912
// 5. Use console.log(reverseCharacters(myVariableName)); to call the function and verify that it correctly reverses the characters in the string.
1013
// 6. Optional: Use method chaining to reduce the lines of code within the function.
14+
let reversedString = 1234;
1115

1216
// Part Two: Reverse Digits
13-
17+
if (typeof reversedString == String) {
18+
reverseCharacters
19+
}
20+
else {
21+
reverseCharacters.toString
22+
}
23+
24+
console.log(reverseCharacters(reversedString))
1425
// 1. Add an if statement to reverseCharacters to check the typeof the parameter.
1526
// 2. If typeof is ‘string’, return the reversed string as before.
1627
// 3. If typeof is ’number’, convert the parameter to a string, reverse the characters, then convert it back into a number.

loops/exercises/for-Loop-Exercises.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
b. Print only the ODD values from 3 - 29, one number per line.
44
c. Print the EVEN numbers 12 to -14 in descending order, one number per line.
55
d. Challenge - Print the numbers 50 - 20 in descending order, but only if the numbers are multiples of 3. (Your code should work even if you replace 50 or 20 with other numbers). */
6+
for (let i = 0; i <21; i++){
7+
console.log (i);
8+
}
69

710

811

more-on-functions/studio/part-one-find-minimum-value.js

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,53 @@ let nums1 = [5, 10, 2, 42];
55
let nums2 = [-2, 0, -10, -44, 5, 3, 0, 3];
66
let nums3 = [200, 5, 4, 10, 8, 5, -3.3, 4.4, 0];
77

8+
9+
10+
function minValue(array){
11+
let min = array[0];
12+
for(i = 1; i < array.length ; i++){
13+
if (array[i] < min ){
14+
min = array[i];
15+
16+
}
17+
18+
}
19+
return (min);
20+
}
21+
function sortArray(array){
22+
let arrayToSort = [];
23+
while(array.length !== 0){
24+
let minimum = minValue(array);
25+
arrayToSort.push(minimum);
26+
array.splice(array.indexOf(minimum),1);
27+
}
28+
return arrayToSort;
29+
}
30+
console.log(sortArray(nums1));
31+
console.log(sortArray(nums2));
32+
console.log(sortArray(nums3));
33+
34+
35+
// let min;
36+
// let j = 0;
37+
38+
// for(i= 0; i < array.length ; i++){
39+
// if (array[i] > min){
40+
// min = i;
41+
// }
42+
43+
44+
45+
// }
46+
// j++;
47+
848
//Using one of the test arrays as the argument, call your function inside the console.log statement below.
49+
// function compareNumbers(a,b){
50+
// return a - b ;
51+
// }
52+
// nums1.sort(compareNumbers);
53+
// nums2.sort(compareNumbers);
54+
// nums3.sort(compareNumbers);
55+
// console.log(nums1,nums2,nums3);
956

10-
console.log(/* your code here */);
57+
console.log(/* your code here */);

0 commit comments

Comments
 (0)