diff --git a/caesar/README.md b/caesar/README.md index c3daca9..1a5c623 100644 --- a/caesar/README.md +++ b/caesar/README.md @@ -1,6 +1,6 @@ -# Exercise XX - caesar cipher +# Exercise XX - Caesar cipher -Implement the legendary caesar cipher: +Implement the legendary Caesar cipher: > 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. @@ -31,5 +31,3 @@ negative numbers should work as well: ```javascript caesar('Mjqqt, Btwqi!', -5) // returns 'Hello, World!' ``` - - diff --git a/calculator/calculator.js b/calculator/calculator.js index 57ed93e..d45cc64 100644 --- a/calculator/calculator.js +++ b/calculator/calculator.js @@ -1,42 +1,42 @@ const add = function(a, b) { return a + b; -} +}; const subtract = function(a, b) { return a - b; -} +}; const sum = function(array) { return array.reduce((total, current) => total + current, 0); -} +}; const multiply = function(array) { return array.length ? array.reduce((accumulator, nextItem) => accumulator * nextItem) : 0; -} +}; const power = function(a, b) { return Math.pow(a, b); -} +}; const factorial = function(n) { - if (n == 0) return 1; + if (n === 0) return 1; let product = 1; for (let i = n; i > 0; i--) { product *= i; } return product; -} +}; // This is another implementation of Factorial that uses recursion // THANKS to @ThirtyThreeB! const recursiveFactorial = function(n) { - if (n===0){ + if (n === 0) { return 1; } return n * recursiveFactorial (n-1); -} +}; module.exports = { add, diff --git a/fibonacci/README.md b/fibonacci/README.md index 1a5b1f6..698c42d 100644 --- a/fibonacci/README.md +++ b/fibonacci/README.md @@ -1,8 +1,8 @@ -# Exercise XX - fibonacci +# Exercise XX - Fibonacci -Create a function that returns a specific member of the fibonacci sequence: +Create a function that returns a specific member of the Fibonacci sequence: -> 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. +> 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. ```javascript fibonacci(4) // returns the 4th member of the series: 3 (1, 1, 2, 3) diff --git a/fibonacci/fibonacci.js b/fibonacci/fibonacci.js index dbb906a..29ea89d 100644 --- a/fibonacci/fibonacci.js +++ b/fibonacci/fibonacci.js @@ -1,6 +1,6 @@ const fibonacci = function(count) { if (count < 0) return "OOPS"; - if (count == 0) return 0; + if (count === 0) return 0; let a = 0; let b = 1; for (let i = 1; i < count; i++) { diff --git a/findTheOldest/README.md b/findTheOldest/README.md index 033ad96..a3d1cef 100644 --- a/findTheOldest/README.md +++ b/findTheOldest/README.md @@ -1,9 +1,8 @@ # Find the Oldest -given an array of objects representing people with a birth and death year, return the oldest person. +Given an array of objects representing people with a birth and death year, return the oldest person. ## Hints - You should return the whole person object, but the tests mostly just check to make sure the name is correct. - this can be done with a couple of chained array methods, or by using `reduce`. - One of the tests checks for people with no death-date.. use JavaScript's Date function to get their age as of today. - diff --git a/findTheOldest/findTheOldest.js b/findTheOldest/findTheOldest.js index 80d830b..1c4714d 100644 --- a/findTheOldest/findTheOldest.js +++ b/findTheOldest/findTheOldest.js @@ -4,13 +4,13 @@ const findTheOldest = function(array) { const currentAge = getAge(currentPerson.yearOfBirth, currentPerson.yearOfDeath) return oldestAge < currentAge ? currentPerson : oldest }) -} +}; const getAge = function(birth, death) { if (!death) { death = new Date().getFullYear(); } return death - birth; -} +}; -module.exports = findTheOldest +module.exports = findTheOldest; diff --git a/getTheTitles/README.md b/getTheTitles/README.md index 20595f2..94cc5d4 100644 --- a/getTheTitles/README.md +++ b/getTheTitles/README.md @@ -15,7 +15,7 @@ const books = [ ] ``` -your job is to write a function that takes the array and returns an array of titles: +Your job is to write a function that takes the array and returns an array of titles: ```javascript getTheTitles(books) // ['Book','Book2'] diff --git a/getTheTitles/getTheTitles.js b/getTheTitles/getTheTitles.js index 8f8fe80..1888c2b 100644 --- a/getTheTitles/getTheTitles.js +++ b/getTheTitles/getTheTitles.js @@ -1,5 +1,5 @@ const getTheTitles = function(array) { return array.map(book => book.title) -} +}; -module.exports = getTheTitles +module.exports = getTheTitles; diff --git a/helloWorld/helloWorld.js b/helloWorld/helloWorld.js index 7d01115..b542f3b 100644 --- a/helloWorld/helloWorld.js +++ b/helloWorld/helloWorld.js @@ -1,5 +1,5 @@ const helloWorld = function() { return 'Hello, World!' -} +}; -module.exports = helloWorld +module.exports = helloWorld; diff --git a/leapYears/leapYears.js b/leapYears/leapYears.js index 4a8d8d2..0967efa 100644 --- a/leapYears/leapYears.js +++ b/leapYears/leapYears.js @@ -1,5 +1,5 @@ const leapYears = function(year) { - return year % 4 === 0 && ( year % 100 !== 0 || year % 400 == 0) -} + return year % 4 === 0 && ( year % 100 !== 0 || year % 400 === 0) +}; -module.exports = leapYears +module.exports = leapYears; diff --git a/pigLatin/pigLatin.js b/pigLatin/pigLatin.js index 75f4c2a..7bfeb78 100644 --- a/pigLatin/pigLatin.js +++ b/pigLatin/pigLatin.js @@ -8,7 +8,7 @@ const pigLatin = function(string) { return `${ending}${beginning}ay`; }) .join(" "); - } + }; const firstVowelIndex = function(string) { const vowels = string.match(/[aeiou]/g); @@ -16,6 +16,6 @@ const firstVowelIndex = function(string) { return string.indexOf(vowels[1]); } return string.indexOf(vowels[0]); - } + }; - module.exports = pigLatin \ No newline at end of file + module.exports = pigLatin; \ No newline at end of file diff --git a/removeFromArray/README.md b/removeFromArray/README.md index 101254c..d3a2ee9 100644 --- a/removeFromArray/README.md +++ b/removeFromArray/README.md @@ -8,10 +8,9 @@ removeFromArray([1, 2, 3, 4], 3); // should remove 3 and return [1,2,4] ## Hints -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: +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: - how to remove a single element from an array - how to deal with multiple optional arguments in a javascript function - [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. - [Or this link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). - - + \ No newline at end of file diff --git a/repeatString/repeatString.js b/repeatString/repeatString.js index 36fd49c..de02551 100644 --- a/repeatString/repeatString.js +++ b/repeatString/repeatString.js @@ -5,6 +5,6 @@ const repeatString = function(word, times) { string += word } return string -} +}; -module.exports = repeatString +module.exports = repeatString; diff --git a/reverseString/reverseString.js b/reverseString/reverseString.js index 87c3cc6..d7140a3 100644 --- a/reverseString/reverseString.js +++ b/reverseString/reverseString.js @@ -1,5 +1,5 @@ const reverseString = function(string) { return string.split('').reverse().join('') -} +}; -module.exports = reverseString +module.exports = reverseString; diff --git a/tempConversion/tempConversion.js b/tempConversion/tempConversion.js index 8db2e9e..9490016 100644 --- a/tempConversion/tempConversion.js +++ b/tempConversion/tempConversion.js @@ -1,12 +1,12 @@ const ftoc = function(f) { return Math.round((f - 32) * (5/9) * 10) / 10 -} +}; const ctof = function(c) { return Math.round(((c * 9/5) + 32) * 10) / 10 -} +}; module.exports = { ftoc, ctof -} +};