Skip to content

Commit 51d8b51

Browse files
author
Thea
committed
Repeat String
1 parent ddb3c3f commit 51d8b51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

repeatstring.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//using ES6 repeat() method and ternary operators
2+
3+
function repeatStringNumTimes(str, num) {
4+
return num > 0 ? str.repeat(num) : '';
5+
}
6+

0 commit comments

Comments
 (0)