finished reverseString.js exercise
This commit is contained in:
parent
daeb889802
commit
25625f266b
|
@ -1,5 +1,7 @@
|
||||||
const reverseString = function() {
|
const reverseString = function(string) {
|
||||||
|
const arrayString = [...string];
|
||||||
|
const joinString = arrayString.reverse().join("");
|
||||||
|
return joinString;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = reverseString
|
module.exports = reverseString
|
|
@ -5,11 +5,11 @@ describe('reverseString', function() {
|
||||||
expect(reverseString('hello')).toEqual('olleh');
|
expect(reverseString('hello')).toEqual('olleh');
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('reverses multiple words', function() {
|
it('reverses multiple words', function() {
|
||||||
expect(reverseString('hello there')).toEqual('ereht olleh')
|
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')
|
expect(reverseString('123! abc!')).toEqual('!cba !321')
|
||||||
})
|
})
|
||||||
});
|
});
|
Loading…
Reference in New Issue