Completed challenge

This commit is contained in:
billalp 2019-11-03 22:24:05 +00:00
parent a04ffff1b5
commit 2730659cb3
3 changed files with 8 additions and 10 deletions

View File

@ -7,9 +7,3 @@ reverseString('hello there') // returns 'ereht olleh'
```
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.
## 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,9 @@
const reverseString = function(word) {
return word
.split('')
.splice('')
.reverse()
.join('');
}
module.exports = reverseString

View File

@ -5,11 +5,11 @@ describe('reverseString', function() {
expect(reverseString('hello')).toEqual('olleh');
});
xit('reverses multiple words', function() {
it('reverses multiple words', function() {
expect(reverseString('hello there')).toEqual('ereht olleh')
})
xit('works with numbers and punctuation', function() {
it('works with numbers and punctuation', function() {
expect(reverseString('123! abc!')).toEqual('!cba !321')
})
});