8000 Fist two complete · 0xNull-ops/javascript-exercises@00b4a47 · GitHub
[go: up one dir, main page]

Skip to content

Commit 00b4a47

Browse files
committed
Fist two complete
1 parent a12f311 commit 00b4a47

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

01_helloWorld/helloWorld.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const helloWorld = function() {
2-
return ''
2+
return 'Hello, World!'
33
};
44

55
module.exports = helloWorld;

02_repeatString/repeatString.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
const repeatString = function() {
2-
3-
};
4-
1+
const repeatString = function(str, num) {
2+
if (num <= 0) return '';
3+
4+
let result = '';
5+
for (let i = 0; i < num; i++) {
6+
result = result + str;
7+
}
8+
return result;
9+
}
510
// Do not edit below this line
611
module.exports = repeatString;

03_reverseString/reverseString.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const reverseString = function() {
1+
const reverseString = function(getString) {
2+
3+
return getString.split("").reverse().join("");
24

35
};
46

0 commit comments

Comments
 (0)
0