Skip to content

Commit 710a091

Browse files
sherlyct2013anurag
authored andcommitted
* Create a repeatify folder under string_manipulations (hacktoberfest17#1132)
* Create a JS function to repeat a string called repeatify.js
1 parent 703007e commit 710a091

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//Write down a function which after triggering like this:
2+
//console.log('hello'.repeatify(3))
3+
//Should print hellohellohello.
4+
5+
String.prototype.repeatify =
6+
String.prototype.repeatify ||
7+
function(count) {
8+
return this.repeat(count);
9+
};
10+
11+
console.log("hello".repeatify(3)); //hellohellohello

0 commit comments

Comments
 (0)