8000 Merge pull request #19 from EBoisseauSierra/rewording-instructions · joshbjorn/javascript-exercises@29bd246 · GitHub
[go: up one dir, main page]

Skip to content

Commit 29bd246

Browse files
authored
Merge pull request TheOdinProject#19 from EBoisseauSierra/rewording-instructions
Rewording instructions
2 parents b99fe58 + 00407bd commit 29bd246

33 files changed

+57
-50
lines changed

caesar/caesar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var caesar = function() {
1+
const caesar = function() {
22

33
}
44

caesar/caesar.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var caesar = require('./caesar')
1+
const caesar = require('./caesar')
22

33
describe('caesar', function() {
44
it('works with single letters', function() {
@@ -19,4 +19,7 @@ describe('caesar', function() {
1919
xit('works with large shift factors', function() {
2020
expect(caesar('Hello, World!', 75)).toEqual('Ebiil, Tloia!');
2121
});
22+
xit('works with large negative shift factors', function() {
23+
expect(caesar('Hello, World!', -29)).toEqual('Ebiil, Tloia!');
24+
});
2225
});

calculator/calculator.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var calculator = require ('./calculator.js');
1+
const calculator = require ('./calculator.js');
22

33
describe('add', function() {
44
it('adds 0 and 0', function() {

fibonacci/fibonacci.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var fibonacci = function() {
1+
const fibonacci = function() {
22

33
}
44

fibonacci/fibonacci.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var fibonacci = require('./fibonacci')
1+
const fibonacci = require('./fibonacci')
22

33
describe('fibonacci', function() {
44
it('works', function() {

generator-exercise/generators/app/templates/title.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var <%= title %> = function() {
1+
let <%= title %> = function() {
22

33
}
44

generator-exercise/generators/app/templates/title.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var <%= title %> = require('./<%=title%>')
1+
let <%= title %> = require('./<%=title%>')
22

33
describe('<%=title%>', function() {
44
it('EDITME', function() {

helloWorld/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This setup should be the same for all of the exercises. The plain javascript fi
1010

1111
Let's look at the spec file first:
1212
```javascript
13-
var helloWorld = require('./helloWorld');
13+
const helloWorld = require('./helloWorld');
1414

1515
describe('Hello World', function() {
1616
it('says hello world', function() {
@@ -26,7 +26,7 @@ For now you do not need to worry about how to write tests, but you should try to
2626

2727
so let's look at the javascript file:
2828
```javascript
29-
var helloWorld = function() {
29+
const helloWorld = function() {
3030
return ''
3131
}
3232

@@ -40,7 +40,7 @@ Just to make sure, in case you're confused at this point, the test is telling yo
4040

4141
this is what the final function should look like:
4242
```javascript
43-
var helloWorld = function() {
43+
const helloWorld = function() {
4444
return 'Hello, World!'
4545
}
4646

helloWorld/helloWorld.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var helloWorld = function() {
1+
const helloWorld = function() {
22
return ''
33
}
44

5-
module.exports = helloWorld
5+
module.exports = helloWorld

helloWorld/helloWorld.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var helloWorld = require('./helloWorld');
1+
const helloWorld = require('./helloWorld');
22

33
describe('Hello World', function() {
44
it('says hello world', function() {
55
expect(helloWorld()).toEqual('Hello, World!');
66
});
7-
});
7+
});

leapYears/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ leapYears(1985) // is not a leap year: returns false
1010
```
1111

1212

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

leapYears/leapYears.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var leapYears = function() {
1+
const leapYears = function() {
22

33
}
44

leapYears/leapYears.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var leapYears = require('./leapYears')
1+
const leapYears = require('./leapYears')
22

33
describe('leapYears', function() {
44
it('works with non century years', function() {

palindromes/palindromes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var palindromes = function() {
1+
const palindromes = function() {
22

33
}
44

palindromes/palindromes.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var palindromes = require('./palindromes')
1+
const palindromes = require('./palindromes')
22

33
describe('palindromes', function() {
44
it('works with single words', function() {

pig_latin/pigLatin.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
// See https://en.wikipedia.org/wiki/Pig_Latin for more details.
1717

18-
var pigLatin = require("./pigLatin.js");
18+
const pigLatin = require("./pigLatin.js");
1919

2020
describe('#translate', function() {
2121
it('translates a word beginning with a vowel', function() {
@@ -61,4 +61,4 @@ describe('#translate', function() {
6161
s = pigLatin.translate("the quick brown fox");
6262
expect(s).toEqual("ethay ickquay ownbray oxfay");
6363
});
64-
});
64+
});

removeFromArray/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ remove([1,2,3,4], 3) // should remove 3 and return [1,2,4]
88

99

1010

11-
## hints
11+
## Hints
1212
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:
1313
- how to remove a single element from an array
1414
- how to deal with multiple optional arguments in a javascript function

removeFromArray/removeFromArray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var removeFromArray = function() {
1+
const removeFromArray = function() {
22

33
}
44

removeFromArray/removeFromArray.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var removeFromArray = require('./removeFromArray')
1+
const removeFromArray = require('./removeFromArray')
22

33
describe('removeFromArray', function() {
44
it('removes a single value', function() {

repeatString/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ Write a function that simply repeats the string a given number of times:
66
repeatString('hey', 3) // returns 'heyheyhey'
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 (see in file `repeatString.spec.js`). Only the first test is currently enabled. So after making sure that this first one passes, enable the others one by one by deleting the `x` in front of the `it()` function.
1010

1111

12-
## hints
12+
## Hints
1313

14-
You're going to want to use a loop for this one.
14+
- You're going to want to use a loop for this one.
1515

16-
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.
16+
- 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.
1717

18+
- If running `jasmine tempConversion/tempConversion.spec.js` raises `Temporarily disabled with xit` errors, make sure you have enabled the rest of the tests (see above).

repeatString/repeatString.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var repeatString = function() {
1+
const repeatString = function() {
22

33
}
44

repeatString/repeatString.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var repeatString = require('./repeatString')
1+
const repeatString = require('./repeatString')
22

33
describe('repeatString', function() {
44
it('repeats the string', function() {

reverseString/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ You will notice in this exercise that there are multiple tests, after making the
1111

1212

1313

14-
## hints
14+
## Hints
1515
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.

reverseString/reverseString.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var reverseString = function() {
1+
const reverseString = function() {
22

33
}
44

5-
module.exports = reverseString
5+
module.exports = reverseString

reverseString/reverseString.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var reverseString = require('./reverseString')
1+
const reverseString = require('./reverseString')
22

33
describe('reverseString', function() {
44
it('reverses single word', function() {
@@ -12,4 +12,4 @@ describe('reverseString', function() {
1212
xit('works with numbers and punctuation', function() {
1313
expect(reverseString('123! abc!')).toEqual('!cba !321')
1414
})
15-
});
15+
});

snakeCase/snakeCase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var snakeCase = function() {
1+
const snakeCase = function() {
22

33
}
44

snakeCase/snakeCase.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var snakeCase = require('./snakeCase')
1+
const snakeCase = require('./snakeCase')
22

33
describe('snakeCase', function() {
44
it('works with simple lowercased phrases', function() {

sumAll/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sumAll(1, 4) // returns the sum of 1 + 2 + 3 + 4 which is 10
77
```
88

99

10-
## hints
10+
## Hints
1111

1212
Think about how you would do this on pen and paper and then how you might translate that process into code:
1313
- create a variable to hold the final sum

sumAll/sumAll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var sumAll = function() {
1+
const sumAll = function() {
22

33
}
44

sumAll/sumAll.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var sumAll = require('./sumAll')
1+
const sumAll = require('./sumAll')
22

33
describe('sumAll', function() {
44
it('sums numbers within the range', function() {

tempConversion/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Exercise 06 - tempConversion
22

3-
This exercise asks you to create more than one function so the module.exports section of the spec file looks a little different this time. Nothing to worry about, we're just packaging the functions into an object to be exported.
4-
5-
Write two functions that convert temperatures from Fahrenheit to Celsius (and the other way around):
3+
Write two functions that convert temperatures from Fahrenheit to Celsius, and vice versa:
64
```
75
ftoc(32) // fahrenheit to celsius, should return 0
86
97
ctof(0) // celsius to fahrenheit, should return 32
108
```
119

10+
Because we are human, we want the result temperature to be rounded to one decimal place: i.e., `ftoc(100)` should return `37.8` and not `37.77777777777778`.
11+
12+
This exercise asks you to create more than one function so the `module.exports` section of the spec file looks a little different this time. Nothing to worry about, we're just packaging both functions into a single object to be exported.
13+
14+
## Hints
15+
- You can find the relevant formulae on [Wikipedia](https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature).
1216

13-
## hints
14-
The math here is fairly straightforward.. just google the formula and implement it in the code
17+
- Try to find by yourself on the Internet how to round a number to 1 decimal place in JavaScript. If you struggle, have a look [here](https://stackoverflow.com/q/7342957/5433628).

tempConversion/tempConversion.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
var ftoc = function() {
2-
1+
const ftoc = function() {
2+
33
}
44

5-
var ctof = function() {
6-
5+
const ctof = function() {
6+
77
}
88

99
module.exports = {

tempConversion/tempConversion.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1, 55ED 4 @@
1-
var {ftoc, ctof} = require('./tempConversion')
1+
const {ftoc, ctof} = require('./tempConversion')
22

33
describe('ftoc', function() {
44
it('works', function() {

0 commit comments

Comments
 (0)
0