diff --git a/03_reverseString/reverseString.js b/03_reverseString/reverseString.js index f6790f0..28111ae 100644 --- a/03_reverseString/reverseString.js +++ b/03_reverseString/reverseString.js @@ -1,5 +1,9 @@ -const reverseString = function() { - +const reverseString = function(string) { + let output = ""; + for (let i = 0; i < string.length; i++) { + output += string.charAt(string.length - i - 1); + } + return output; }; // Do not edit below this line diff --git a/03_reverseString/reverseString.spec.js b/03_reverseString/reverseString.spec.js index 8adb887..b51c50e 100644 --- a/03_reverseString/reverseString.spec.js +++ b/03_reverseString/reverseString.spec.js @@ -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('') }) });