8000 reverse String · dbateman3/javascript-exercises@82dc28e · GitHub
[go: up one dir, main page]

Skip to content

Commit 82dc28e

Browse files
committed
reverse String
1 parent b95fa8e commit 82dc28e

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

01-helloWorld/helloWorld.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var helloWorld = require('./helloWorld');
22

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

02-reverseString/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Exercise 02 - Reverse a String.
2+
3+
Pretty simple, write a function called `reverseString` that returns it's input, reversed!
4+
5+
```javascript
6+
reverseString('hello there') // returns 'ereht olleh'
7+
```
8+
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.

02-reverseString/reverseString.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var reverseString = function() {
2+
3+
}
4+
5+
module.exports = reverseString
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var reverseString = require('./reverseString')
2+
3+
describe('Hello World', function() {
4+
it('reverses single word', function() {
5+
expect(reverseString('hello')).toEqual('olleh');
6+
});
7+
8+
xit('reverses multiple words', function() {
9+
expect(reverseString('hello there')).toEqual('ereht olleh')
10+
})
11+
12+
xit('works with numbers and punctuation', function() {
13+
expect(reverseString('123! abc!')).toEqual('!cba !321')
14+
})
15+
});

0 commit comments

Comments
 (0)
0