Skip to content

Commit e991d13

Browse files
authored
Merge pull request #67 from gitlep1/Updated
Added better consistency throughout the assignment.
2 parents da373ac + b387a93 commit e991d13

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ You don't have to write an answer to the thought questions.
7878

7979
#### Map
8080

81-
1. make a new array of each number multiplied by 100
82-
1. make a new array of all the words in all uppercase
81+
1. Make a new array of each number squared and then multiplied by their index number
82+
1. Make a new array of all the words in all uppercase
8383

8484
**Thought Questions**
8585

_tests_/array-methods.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const {
55
arrayOddLengthWords,
66
firstValDivisibleBy4,
77
firstWordLongerThan4Char,
8+
firstNumIndexDivisibleBy3,
9+
firstWordIndexLessThan2Char,
810
logValuesTimes3,
911
logWordsWithExclamation,
1012
arrayValuesSquaredTimesIndex,
@@ -56,6 +58,18 @@ describe("Array Methods", () => {
5658
expect(firstWordLongerThan4Char(words)).toBe("quick");
5759
});
5860

61+
test("Find the index of the first number that is divisible by 3", () => {
62+
expect(/\.findIndex/.test(firstNumIndexDivisibleBy3.toString())).toBe(true);
63+
expect(firstNumIndexDivisibleBy3(nums)).toBe(2);
64+
});
65+
66+
test("Find the index of the first word that is less than 2 characters long", () => {
67+
expect(/\.findIndex/.test(firstWordIndexLessThan2Char.toString())).toBe(
68+
true
69+
);
70+
expect(firstWordIndexLessThan2Char(words)).toBe(-1);
71+
});
72+
5973
test("Console log the values times 3", () => {
6074
expect(/\.forEach/.test(logValuesTimes3.toString(nums))).toBe(true);
6175
expect(logValuesTimes3(nums)).toBe(undefined);

package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

solution.js

+12
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ const firstWordLongerThan4Char = () => {
2929
//
3030
};
3131

32+
// Find Index
33+
34+
const firstNumIndexDivisibleBy3 = () => {
35+
//
36+
};
37+
38+
const firstWordIndexLessThan2Char = () => {
39+
//
40+
};
41+
3242
// For Each
3343

3444
const logValuesTimes3 = () => {
@@ -66,6 +76,8 @@ module.exports = {
6676
arrayOddLengthWords,
6777
firstValDivisibleBy4,
6878
firstWordLongerThan4Char,
79+
firstNumIndexDivisibleBy3,
80+
firstWordIndexLessThan2Char,
6981
logValuesTimes3,
7082
logWordsWithExclamation,
7183
arrayValuesSquaredTimesIndex,

0 commit comments

Comments
 (0)