solved exercise

This commit is contained in:
Mateusz Bujak 2022-07-22 14:34:46 +02:00
parent 65018d4d70
commit 1583c2434b
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,12 @@
const reverseString = function() {
const reverseString = function(string) {
let result = '';
for (let i = string.length - 1; i >= 0; i--) {
result += string[i];
}
return result;
};
// Do not edit below this line

View File

@ -5,14 +5,14 @@ describe('reverseString', () => {
expect(reverseString('hello')).toEqual('olleh');
});
test.skip('reverses multiple words', () => {
test('reverses multiple words', () => {
expect(reverseString('hello there')).toEqual('ereht olleh')
})
test.skip('works with numbers and punctuation', () => {
test('works with numbers and punctuation', () => {
expect(reverseString('123! abc!')).toEqual('!cba !321')
})
test.skip('works with blank strings', () => {
test('works with blank strings', () => {
expect(reverseString('')).toEqual('')
})
});