Passed all tests for exercise 03
This commit is contained in:
parent
7202752aa2
commit
bf01232806
|
@ -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
|
// Do not edit below this line
|
||||||
|
|
|
@ -5,14 +5,14 @@ describe('reverseString', () => {
|
||||||
expect(reverseString('hello')).toEqual('olleh');
|
expect(reverseString('hello')).toEqual('olleh');
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('reverses multiple words', () => {
|
test('reverses multiple words', () => {
|
||||||
expect(reverseString('hello there')).toEqual('ereht olleh')
|
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')
|
expect(reverseString('123! abc!')).toEqual('!cba !321')
|
||||||
})
|
})
|
||||||
test.skip('works with blank strings', () => {
|
test('works with blank strings', () => {
|
||||||
expect(reverseString('')).toEqual('')
|
expect(reverseString('')).toEqual('')
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue