Finished exercise 3
This commit is contained in:
		
							parent
							
								
									1e55ec634b
								
							
						
					
					
						commit
						88fc7f3aed
					
				| 
						 | 
				
			
			@ -1,5 +1,10 @@
 | 
			
		|||
const reverseString = function() {
 | 
			
		||||
 | 
			
		||||
const reverseString = function(string) {
 | 
			
		||||
    idxLenString = string.length - 1;
 | 
			
		||||
    new_str = '';
 | 
			
		||||
    for (i = idxLenString; i >= 0; i--) {
 | 
			
		||||
        new_str = new_str + string[i]
 | 
			
		||||
    }
 | 
			
		||||
    return new_str;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Do not edit below this line
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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('')
 | 
			
		||||
  })
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue