Add files via upload

This commit is contained in:
reddforman 2022-11-07 15:51:13 -05:00 committed by GitHub
parent 277d606197
commit 6452976a23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -1,5 +1,14 @@
const reverseString = function() {
const reverseString = function(string) {
const splitString = string.split("");
let reverse = "";
for (let i = (splitString.length - 1); i >= 0; i--) {
const pullString = splitString[i];
reverse += pullString;
}
return reverse;
};
// 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('')
})
});