commit
						1c61eff58c
					
				| 
						 | 
				
			
			@ -6,13 +6,8 @@ Write a function that simply repeats the string a given number of times:
 | 
			
		|||
repeatString('hey', 3) // returns 'heyheyhey'
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
You will notice in this exercise that there are multiple tests (see in file `repeatString.spec.js`). Only the first test is currently enabled. So after making sure that this first one passes, enable the others one by one by deleting the `x` in front of the `it()` function.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Hints
 | 
			
		||||
 | 
			
		||||
- You're going to want to use a loop for this one.
 | 
			
		||||
 | 
			
		||||
- Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop.
 | 
			
		||||
 | 
			
		||||
- If running `jasmine repeatString.spec.js` raises `Temporarily disabled with xit` errors, make sure you have enabled the rest of the tests (see above).
 | 
			
		||||
- Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop.
 | 
			
		||||
| 
						 | 
				
			
			@ -4,15 +4,19 @@ describe('repeatString', function() {
 | 
			
		|||
  it('repeats the string', function() {
 | 
			
		||||
    expect(repeatString('hey', 3)).toEqual('heyheyhey');
 | 
			
		||||
  });
 | 
			
		||||
  
 | 
			
		||||
  xit('repeats the string many times', function() {
 | 
			
		||||
    expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey');
 | 
			
		||||
  });
 | 
			
		||||
  
 | 
			
		||||
  xit('repeats the string 1 times', function() {
 | 
			
		||||
    expect(repeatString('hey', 1)).toEqual('hey');
 | 
			
		||||
  });
 | 
			
		||||
  
 | 
			
		||||
  xit('repeats the string 0 times', function() {
 | 
			
		||||
    expect(repeatString('hey', 0)).toEqual('');
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  xit('returns ERROR with negative numbers', function() {
 | 
			
		||||
    expect(repeatString('hey', -1)).toEqual('ERROR');
 | 
			
		||||
  });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue