tests ✅ pass reverseString
This commit is contained in:
		
							parent
							
								
									f5d662406d
								
							
						
					
					
						commit
						80a1fe5c6c
					
				| 
						 | 
				
			
			@ -1,5 +1,13 @@
 | 
			
		|||
const reverseString = function() {
 | 
			
		||||
const reverseString = function(string) {
 | 
			
		||||
    const newArray = Array.from(string).reverse();
 | 
			
		||||
    var returnString = ""
 | 
			
		||||
 | 
			
		||||
    for (i = 0; i < newArray.length; i++) {
 | 
			
		||||
        returnString += newArray[i];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return returnString;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 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