Solved problem 1
This commit is contained in:
parent
5c39ba4078
commit
f9b8d2d403
|
@ -1,4 +1,15 @@
|
|||
const repeatString = function() {
|
||||
const repeatString = function(sourceString, stringCount) {
|
||||
//Declare variable/s
|
||||
let resultString = '';
|
||||
|
||||
|
||||
// Create a for loop to repeat the string
|
||||
for (let i = 0; i < stringCount; i++) {
|
||||
resultString = resultString + sourceString;
|
||||
}
|
||||
|
||||
return resultString;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ describe('repeatString', function() {
|
|||
xit('returns ERROR with negative numbers', function() {
|
||||
expect(repeatString('hey', -1)).toEqual('ERROR');
|
||||
});
|
||||
xit('repeats the string a random amount of times', function () {
|
||||
xit('repeats the string a random amount of times', function() {
|
||||
/*The number is generated by using Math.random to get a value from between
|
||||
0 to 1, when this is multiplied by 1000 and rounded down with Math.floor it
|
||||
equals a number between 0 to 999 (this number will change everytime you run
|
||||
|
|
Loading…
Reference in New Issue