Skip to content

Commit 1018bd7

Browse files
committed
done
1 parent 0875086 commit 1018bd7

File tree

1 file changed

+33
-132
lines changed

1 file changed

+33
-132
lines changed
Lines changed: 33 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
// Find the maximum
2-
function maxOfTwoNumbers (first, second) {
3-
1+
function maxOfTwoNumbers(first, second){
2+
if (first > second){
3+
return first
4+
}
5+
else{
6+
return second
7+
}
48
}
59

610
var largest = maxOfTwoNumbers(2, 6);
711
console.log(largest);
812

9-
// Finding Longest Word
10-
function findLongestWord (words) {
1113

12-
}
1314

14-
var words = [
15+
16+
17+
18+
var words = [
1519
"mystery",
1620
"brother",
1721
"aviator",
@@ -20,142 +24,39 @@ var words = [
2024
"orchard",
2125
"crackpot"
2226
];
23-
var longest = findLongestWord(words);
24-
console.log(longest);
25-
26-
// Calculating a Sum
27-
function sumArray (array) {
28-
29-
}
3027

31-
var numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10];
32-
var total = sumArray(numbers);
33-
console.log(total);
28+
function longWord (cow){
29+
var arrayOfLengths = [];
30+
cow.forEach(function(word){
31+
arrayOfLengths.push(word.length);
32+
arrayOfLengths.sort('').reverse('');
3433

35-
// Calculate the Average
36-
function averageNumbers (array) {
34+
});
35+
console.log(arrayOfLengths[0])
3736

37+
for (i=0; i < words.length; i++) {
38+
if (words[i].length === arrayOfLengths[0]) {
39+
console.log(words[i]);
40+
}
41+
}
3842
}
3943

40-
var numbers = [2, 6, 9, 10, 7, 4, 1, 9];
41-
var average = averageNumbers(numbers);
42-
console.log(average);
44+
longWord(words);
4345

44-
// Array of Strings
45-
function averageWordLength (array) {
4646

47-
}
4847

49-
var words = [
50-
"seat",
51-
"correspond",
52-
"linen",
53-
"motif",
54-
"hole",
55-
"smell",
56-
"smart",
57-
"chaos",
58-
"fuel",
59-
"palace"
60-
];
61-
var averageLength = averageWordLength(words);
62-
console.log(averageLength);
6348

64-
// Unique Arrays
65-
function uniquifyArray (array) {
6649

67-
}
50+
var numbers = [6, 12, 1, 18, 13, 16, 2, 1, 8, 10]
6851

69-
var words = [
70-
"crab",
71-
"poison",
72-
"contagious",
73-
"simple",
74-
"bring",
75-
"sharp",
76-
"playground",
77-
"poison",
78-
"communion",
79-
"simple",
80-
"bring"
81-
];
82-
var uniqued = uniquifyArray(words);
83-
console.log(uniqued);
84-
85-
// Finding Elements
86-
function doesWordExist (wordsArray, word) {
8752

53+
function sumArray(array){
54+
var total = 0;
55+
for(var i = 0; i < array.length; i++){
56+
total += array[i];
57+
}
58+
return total;
8859
}
8960

90-
var words = [
91-
"machine",
92-
"subset",
93-
"trouble",
94-
"starting",
95-
"matter",
96-
"eating",
97-
"truth",
98-
"disobedience"
99-
];
100-
101-
var hasMatter = doesWordExist(words, "matter");
102-
console.log(hasMatter);
103-
104-
var hasDog = doesWordExist(words, "dog");
105-
console.log(hasDog);
106-
107-
// Counting Repetion
108-
function howManyTimes (words, word) {
109-
110-
}
111-
112-
var words = [
113-
"machine",
114-
"matter",
115-
"subset",
116-
"trouble",
117-
"starting",
118-
"matter",
119-
"eating",
120-
"matter",
121-
"truth",
122-
"disobedience",
123-
"matter"
124-
];
125-
126-
var howManyMatter = howManyTimes(words, "matter");
127-
console.log(howManyMatter);
128-
129-
var howManyDog = howManyTimes(words, "dog");
130-
console.log(howManyDog);
131-
132-
// Bonus Quest
133-
function greatestProduct (matrix) {
134-
135-
}
136-
137-
var matrix = [
138-
[08,02,22,97,38,15,0,40,0,75,04,05,07,78,52,12,50,77,91,08],
139-
[49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,0],
140-
[81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65],
141-
[52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91],
142-
[22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80],
143-
[24,47,32,60,99,03,45,02,44,75,33,53,78,36,84,20,35,17,12,50],
144-
[32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70],
145-
[67,26,20,68,02,62,12,20,95,63,94,39,63,08,40,91,66,49,94,21],
146-
[24,55,58,05,66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72],
147-
[21,36,23,09,75,0,76,44,20,45,35,14,0,61,33,97,34,31,33,95],
148-
[78,17,53,28,22,75,31,67,15,94,03,80,04,62,16,14,09,53,56,92],
149-
[16,39,05,42,96,35,31,47,55,58,88,24,0,17,54,24,36,29,85,57],
150-
[86,56,0,48,35,71,89,07,05,44,44,37,44,60,21,58,51,54,17,58],
151-
[19,80,81,68,05,94,47,69,28,73,92,13,86,52,17,77,04,89,55,40],
152-
[04,52,08,83,97,35,99,16,07,97,57,32,16,26,26,79,33,27,98,66],
153-
[88,36,68,87,57,62,20,72,03,46,33,67,46,55,12,32,63,93,53,69],
154-
[04,42,16,73,38,25,39,11,24,94,72,18,08,46,29,32,40,62,76,36],
155-
[20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,04,36,16],
156-
[20,73,35,29,78,31,90,01,74,31,49,71,48,86,81,16,23,57,05,54],
157-
[01,70,54,71,83,51,54,69,16,92,33,48,61,43,52,01,89,19,67,48],
158-
];
159-
160-
var maxProduct = greatestProduct(matrix);
161-
console.log(maxProduct);
61+
var result = sumArray(numbers);
62+
console.log(result);

0 commit comments

Comments
 (0)