From 8aefa82522c17999a2ceec9318bc86168713a662 Mon Sep 17 00:00:00 2001 From: Nidhish1407 Date: Mon, 24 Aug 2020 19:09:19 +0530 Subject: [PATCH] Added solution for repeatString --- helloWorld/helloWorld.js | 4 ++-- repeatString/repeatString.js | 13 ++++++++++++- repeatString/repeatString.spec.js | 12 ++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/helloWorld/helloWorld.js b/helloWorld/helloWorld.js index a41264d..3fc431e 100644 --- a/helloWorld/helloWorld.js +++ b/helloWorld/helloWorld.js @@ -1,5 +1,5 @@ const helloWorld = function() { - return '' + return 'Hello, World!' } -module.exports = helloWorld +module.exports = helloWorld \ No newline at end of file diff --git a/repeatString/repeatString.js b/repeatString/repeatString.js index 770119a..201822a 100644 --- a/repeatString/repeatString.js +++ b/repeatString/repeatString.js @@ -1,5 +1,16 @@ -const repeatString = function() { +const repeatString = function(str,n) { + let ans = ''; + + if(n<0) + return 'ERROR'; + else + { + for(let i=0;i