Merge pull request #19 from EBoisseauSierra/rewording-instructions

Rewording instructions
This commit is contained in:
Cody Loyd 2018-08-07 08:06:55 -05:00 committed by GitHub
commit 29bd246dad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 57 additions and 50 deletions

View file

@ -1,4 +1,4 @@
var caesar = function() {
const caesar = function() {
}

View file

@ -1,4 +1,4 @@
var caesar = require('./caesar')
const caesar = require('./caesar')
describe('caesar', function() {
it('works with single letters', function() {
@ -19,4 +19,7 @@ describe('caesar', function() {
xit('works with large shift factors', function() {
expect(caesar('Hello, World!', 75)).toEqual('Ebiil, Tloia!');
});
xit('works with large negative shift factors', function() {
expect(caesar('Hello, World!', -29)).toEqual('Ebiil, Tloia!');
});
});

View file

@ -1,4 +1,4 @@
var calculator = require ('./calculator.js');
const calculator = require ('./calculator.js');
describe('add', function() {
it('adds 0 and 0', function() {

View file

@ -1,4 +1,4 @@
var fibonacci = function() {
const fibonacci = function() {
}

View file

@ -1,4 +1,4 @@
var fibonacci = require('./fibonacci')
const fibonacci = require('./fibonacci')
describe('fibonacci', function() {
it('works', function() {

View file

@ -1,4 +1,4 @@
var <%= title %> = function() {
let <%= title %> = function() {
}

View file

@ -1,4 +1,4 @@
var <%= title %> = require('./<%=title%>')
let <%= title %> = require('./<%=title%>')
describe('<%=title%>', function() {
it('EDITME', function() {

View file

@ -10,7 +10,7 @@ This setup should be the same for all of the exercises. The plain javascript fi
Let's look at the spec file first:
```javascript
var helloWorld = require('./helloWorld');
const helloWorld = require('./helloWorld');
describe('Hello World', function() {
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
so let's look at the javascript file:
```javascript
var helloWorld = function() {
const helloWorld = function() {
return ''
}
@ -40,7 +40,7 @@ Just to make sure, in case you're confused at this point, the test is telling yo
this is what the final function should look like:
```javascript
var helloWorld = function() {
const helloWorld = function() {
return 'Hello, World!'
}

View file

@ -1,5 +1,5 @@
var helloWorld = function() {
const helloWorld = function() {
return ''
}
module.exports = helloWorld
module.exports = helloWorld

View file

@ -1,7 +1,7 @@
var helloWorld = require('./helloWorld');
const helloWorld = require('./helloWorld');
describe('Hello World', function() {
it('says hello world', function() {
expect(helloWorld()).toEqual('Hello, World!');
});
});
});

View file

@ -10,5 +10,5 @@ leapYears(1985) // is not a leap year: returns false
```
## hints
## Hints
- use an `if` statement and `&&` to make sure all the conditions are met properly

View file

@ -1,4 +1,4 @@
var leapYears = function() {
const leapYears = function() {
}

View file

@ -1,4 +1,4 @@
var leapYears = require('./leapYears')
const leapYears = require('./leapYears')
describe('leapYears', function() {
it('works with non century years', function() {

View file

@ -1,4 +1,4 @@
var palindromes = function() {
const palindromes = function() {
}

View file

@ -1,4 +1,4 @@
var palindromes = require('./palindromes')
const palindromes = require('./palindromes')
describe('palindromes', function() {
it('works with single words', function() {

View file

@ -15,7 +15,7 @@
// See https://en.wikipedia.org/wiki/Pig_Latin for more details.
var pigLatin = require("./pigLatin.js");
const pigLatin = require("./pigLatin.js");
describe('#translate', function() {
it('translates a word beginning with a vowel', function() {
@ -61,4 +61,4 @@ describe('#translate', function() {
s = pigLatin.translate("the quick brown fox");
expect(s).toEqual("ethay ickquay ownbray oxfay");
});
});
});

View file

@ -8,7 +8,7 @@ remove([1,2,3,4], 3) // should remove 3 and return [1,2,4]
## hints
## 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:
- how to remove a single element from an array
- how to deal with multiple optional arguments in a javascript function

View file

@ -1,4 +1,4 @@
var removeFromArray = function() {
const removeFromArray = function() {
}

View file

@ -1,4 +1,4 @@
var removeFromArray = require('./removeFromArray')
const removeFromArray = require('./removeFromArray')
describe('removeFromArray', function() {
it('removes a single value', function() {

View file

@ -6,12 +6,13 @@ Write a function that simply repeats the string a given number of times:
repeatString('hey', 3) // returns 'heyheyhey'
```
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.
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.
## hints
## Hints
You're going to want to use a loop for this one.
- You're going to want to use a loop for this one.
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.
- 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.
- 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).

View file

@ -1,4 +1,4 @@
var repeatString = function() {
const repeatString = function() {
}

View file

@ -1,4 +1,4 @@
var repeatString = require('./repeatString')
const repeatString = require('./repeatString')
describe('repeatString', function() {
it('repeats the string', function() {

View file

@ -11,5 +11,5 @@ You will notice in this exercise that there are multiple tests, after making the
## hints
## Hints
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.

View file

@ -1,5 +1,5 @@
var reverseString = function() {
const reverseString = function() {
}
module.exports = reverseString
module.exports = reverseString

View file

@ -1,4 +1,4 @@
var reverseString = require('./reverseString')
const reverseString = require('./reverseString')
describe('reverseString', function() {
it('reverses single word', function() {
@ -12,4 +12,4 @@ describe('reverseString', function() {
xit('works with numbers and punctuation', function() {
expect(reverseString('123! abc!')).toEqual('!cba !321')
})
});
});

View file

@ -1,4 +1,4 @@
var snakeCase = function() {
const snakeCase = function() {
}

View file

@ -1,4 +1,4 @@
var snakeCase = require('./snakeCase')
const snakeCase = require('./snakeCase')
describe('snakeCase', function() {
it('works with simple lowercased phrases', function() {

View file

@ -7,7 +7,7 @@ sumAll(1, 4) // returns the sum of 1 + 2 + 3 + 4 which is 10
```
## hints
## Hints
Think about how you would do this on pen and paper and then how you might translate that process into code:
- create a variable to hold the final sum

View file

@ -1,4 +1,4 @@
var sumAll = function() {
const sumAll = function() {
}

View file

@ -1,4 +1,4 @@
var sumAll = require('./sumAll')
const sumAll = require('./sumAll')
describe('sumAll', function() {
it('sums numbers within the range', function() {

View file

@ -1,14 +1,17 @@
# Exercise 06 - tempConversion
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.
Write two functions that convert temperatures from Fahrenheit to Celsius (and the other way around):
Write two functions that convert temperatures from Fahrenheit to Celsius, and vice versa:
```
ftoc(32) // fahrenheit to celsius, should return 0
ctof(0) // celsius to fahrenheit, should return 32
```
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`.
## hints
The math here is fairly straightforward.. just google the formula and implement it in the code
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.
## Hints
- You can find the relevant formulae on [Wikipedia](https://en.wikipedia.org/wiki/Conversion_of_units_of_temperature).
- 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).

View file

@ -1,9 +1,9 @@
var ftoc = function() {
const ftoc = function() {
}
var ctof = function() {
const ctof = function() {
}
module.exports = {

View file

@ -1,4 +1,4 @@
var {ftoc, ctof} = require('./tempConversion')
const {ftoc, ctof} = require('./tempConversion')
describe('ftoc', function() {
it('works', function() {