8000 Merge pull request #3 from TheOdinProject/add-hints · M-Munk/javascript-exercises@2b524fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 2b524fb

Browse files
authored
Merge pull request TheOdinProject#3 from TheOdinProject/add-hints
add hints to exercises
2 parents cf1759d + dd17d8a commit 2b524fb

File tree

7 files changed

+43
-4
lines changed

7 files changed

+43
-4
lines changed

helloWorld/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ var helloWorld = function() {
4545
}
4646

4747
module.exports = helloWorld
48-
```
48+
```
49+
50+
For the most part we've set up these tests in such a way that you only have to write the code being tested. You should not have to worry about importing or exporting anything at this stage.. so just work around that bit of the code and write what it takes to make them pass!

leapYears/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ leapYears(2000) // is a leap year: returns true
99
leapYears(1985) // is not a leap year: returns false
1010
```
1111

12+
13+
## hints
14+
- use an `if` statement and `&&` to make sure all the conditions are met properly

removeFromArray/README.md

Lines changed: 9 additions & 1 deletion
< 10000 td data-grid-cell-id="diff-3dfd5b24b3bc360f67ea46ecc3b1416d05ece1b04da8abd374d53ca2bc8d99ec-7-15-2" data-line-anchor="diff-3dfd5b24b3bc360f67ea46ecc3b1416d05ece1b04da8abd374d53ca2bc8d99ecR15" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-additionLine-bgColor, var(--diffBlob-addition-bgColor-line));padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell right-side-diff-cell left-side">+
- [Check this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments). Scroll down to the bit about `Array.from` or the spread operator.
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@ Implement a function that takes an array and some other arguments then removes t
44

55
```javascript
66
remove([1,2,3,4], 3) // should remove 3 and return [1,2,4]
7-
```
7+
```
8+
9+
10+
11+
## hints
12+
the first test on this one is fairly easy, but there are a few things to think about(or google) here for the later tests:
13+
- how to remove a single element from an array
14+
- how to deal with multiple optional arguments in a javascript function
15

repeatString/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@ repeatString('hey', 3) // returns 'heyheyhey'
88

99

1010

11+
12+
13+
14+
## hints
15+
16+
You're going to want to use a loop for this one.
17+
18+
Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop.
19+

reverseString/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ Pretty simple, write a function called `reverseString` that returns it's input,
66
reverseString('hello there') // returns 'ereht olleh'
77
```
88

9-
You will notice in this exercise that there are multiple tests, after making the first one pass, enable the others one by one by deleting the `x` in front of the `it()` function.
9+
You will notice in this exercise that there are multiple tests, after making the first one pass, enable the others one by one by deleting the `x` in front of the `it()` function.
10+
11+
12+
13+
14+
## hints
15+
Strings in JavaScript cannot be reversed directly so you're going to have to split it into something else first.. do the reversal and then join it back together into a string.

sumAll/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,13 @@ Implement a function that takes 2 integers and returns the sum of every number b
44

55
```javascript
66
sumAll(1, 4) // returns the sum of 1 + 2 + 3 + 4 which is 10
7-
```
7+
```
8+
9+
10+
## hints
11+
12+
Think about how you would do this on pen and paper and then how you might translate that process into code:
13+
- create a variable to hold the final sum
14+
- loop through the given numbers ([link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration))
15+
- on each iteration add the number to the sum
16+
- return the sum after finishing the loop

tempConversion/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ ctof(0) // celsius to fahrenheit, should return 32
1010
```
1111

1212

13+
## hints
14+
The math here is fairly straightforward.. just google the formula and implement it in the code

0 commit comments

Comments
 (0)
0