This commit is contained in:
parent
6b0e0e55e3
commit
7a00112f9a
|
@ -1,5 +1,5 @@
|
||||||
const helloWorld = function() {
|
const helloWorld = function() {
|
||||||
return ''
|
return 'Hello, World!'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = helloWorld;
|
module.exports = helloWorld;
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
const repeatString = function() {
|
const repeatString = function(string, num) {
|
||||||
|
let newString = '';
|
||||||
|
|
||||||
|
for (i = 0; i < num; i++) {
|
||||||
|
newString += string;
|
||||||
|
}
|
||||||
|
return newString;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log(repeatString('hey', 3))
|
||||||
|
|
||||||
// Do not edit below this line
|
// Do not edit below this line
|
||||||
module.exports = repeatString;
|
module.exports = repeatString;
|
||||||
|
|
|
@ -4,13 +4,13 @@ describe('repeatString', () => {
|
||||||
test('repeats the string', () => {
|
test('repeats the string', () => {
|
||||||
expect(repeatString('hey', 3)).toEqual('heyheyhey');
|
expect(repeatString('hey', 3)).toEqual('heyheyhey');
|
||||||
});
|
});
|
||||||
test.skip('repeats the string many times', () => {
|
test('repeats the string many times', () => {
|
||||||
expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey');
|
expect(repeatString('hey', 10)).toEqual('heyheyheyheyheyheyheyheyheyhey');
|
||||||
});
|
});
|
||||||
test.skip('repeats the string 1 times', () => {
|
test('repeats the string 1 times', () => {
|
||||||
expect(repeatString('hey', 1)).toEqual('hey');
|
expect(repeatString('hey', 1)).toEqual('hey');
|
||||||
});
|
});
|
||||||
test.skip('repeats the string 0 times', () => {
|
test('repeats the string 0 times', () => {
|
||||||
expect(repeatString('hey', 0)).toEqual('');
|
expect(repeatString('hey', 0)).toEqual('');
|
||||||
});
|
});
|
||||||
test.skip('returns ERROR with negative numbers', () => {
|
test.skip('returns ERROR with negative numbers', () => {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue