-3 ex done

This commit is contained in:
endritibra 2022-05-30 13:41:52 +02:00
parent 2274346421
commit 4e0fa06dcb
2 changed files with 13 additions and 4 deletions

View File

@ -1,6 +1,15 @@
const reverseString = function() {
const reverseString = function(stringi) {
let test="";
let len=stringi.length;
console.log(len)
for(i=len-1;i>=0;i--){
test+=stringi[i];
}
return test;
};
// Do not edit below this line
module.exports = reverseString;

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('')
})
});