Skip to content

Commit ac4d2a9

Browse files
author
Michael Frank
committed
Grammar cleanups, trailing semicolon for function expressions
1 parent 276b60a commit ac4d2a9

File tree

15 files changed

+39
-43
lines changed

15 files changed

+39
-43
lines changed

caesar/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Exercise XX - caesar cipher
1+
# Exercise XX - Caesar cipher
22

3-
Implement the legendary caesar cipher:
3+
Implement the legendary Caesar cipher:
44

55
> In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence.
66
@@ -31,5 +31,3 @@ negative numbers should work as well:
3131
```javascript
3232
caesar('Mjqqt, Btwqi!', -5) // returns 'Hello, World!'
3333
```
34-
35-

calculator/calculator.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
const add = function(a, b) {
22
return a + b;
3-
}
3+
};
44

55
const subtract = function(a, b) {
66
return a - b;
7-
}
7+
};
88

99
const sum = function(array) {
1010
return array.reduce((total, current) => total + current, 0);
11-
}
11+
};
1212

1313
const multiply = function(array) {
1414
return array.length
1515
? array.reduce((accumulator, nextItem) => accumulator * nextItem)
1616
: 0;
17-
}
17+
};
1818

1919
const power = function(a, b) {
2020
return Math.pow(a, b);
21-
}
21+
};
2222

2323
const factorial = function(n) {
24-
if (n == 0) return 1;
24+
if (n === 0) return 1;
2525
let product = 1;
2626
for (let i = n; i > 0; i--) {
2727
product *= i;
2828
}
2929
return product;
30-
}
30+
};
3131

3232
// This is another implementation of Factorial that uses recursion
3333
// THANKS to @ThirtyThreeB!
3434
const recursiveFactorial = function(n) {
35-
if (n===0){
35+
if (n === 0) {
3636
return 1;
3737
}
3838
return n * recursiveFactorial (n-1);
39-
}
39+
};
4040

4141
module.exports = {
4242
add,

fibonacci/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Exercise XX - fibonacci
1+
# Exercise XX - Fibonacci
22

3-
Create a function that returns a specific member of the fibonacci sequence:
3+
Create a function that returns a specific member of the Fibonacci sequence:
44

5-
> a series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.
5+
> A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.
66
77
```javascript
88
fibonacci(4) // returns the 4th member of the series: 3 (1, 1, 2, 3)

fibonacci/fibonacci.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fibonacci = function(count) {
22
if (count < 0) return "OOPS";
3-
if (count == 0) return 0;
3+
if (count === 0) return 0;
44
let a = 0;
55
let b = 1;
66
for (let i = 1; i < count; i++) {

findTheOldest/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Find the Oldest
22

3-
given an array of objects representing people with a birth and death year, return the oldest person.
3+
Given an array of objects representing people with a birth and death year, return the oldest person.
44

55
## Hints
66
- You should return the whole person object, but the tests mostly just check to make sure the name is correct.
77
- this can be done with a couple of chained array methods, or by using `reduce`.
88
- One of the tests checks for people with no death-date.. use JavaScript's Date function to get their age as of today.
9-

findTheOldest/findTheOldest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ const findTheOldest = function(array) {
44
const currentAge = getAge(currentPerson.yearOfBirth, currentPerson.yearOfDeath)
55
return oldestAge < currentAge ? currentPerson : oldest
66
})
7-
}
7+
};
88

99
const getAge = function(birth, death) {
1010
if (!death) {
1111
death = new Date().getFullYear();
1212
}
1313
return death - birth;
14-
}
14+
};
1515

16-
module.exports = findTheOldest
16+
module.exports = findTheOldest;

getTheTitles/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const books = [
1515
]
1616
```
1717

18-
your job is to write a function that takes the array and returns an array of titles:
18+
Your job is to write a function that takes the array and returns an array of titles:
1919

2020
```javascript
2121
getTheTitles(books) // ['Book','Book2']

getTheTitles/getTheTitles.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const getTheTitles = function(array) {
22
return array.map(book => book.title)
3-
}
3+
};
44

5-
module.exports = getTheTitles
5+
module.exports = getTheTitles;

helloWorld/helloWorld.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const helloWorld = function() {
22
return 'Hello, World!'
3-
}
3+
};
44

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

leapYears/leapYears.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const leapYears = function(year) {
2-
return year % 4 === 0 && ( year % 100 !== 0 || year % 400 == 0)
3-
}
2+
return year % 4 === 0 && ( year % 100 !== 0 || year % 400 === 0)
3+
};
44

5-
module.exports = leapYears
5+
module.exports = leapYears;

0 commit comments

Comments
 (0)