8000 Complete first 2 exercices; problem with 3rd one · rajas2211/javascript-exercises@c75d813 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit c75d813

Browse files
committed
Complete first 2 exercices; problem with 3rd one
1 parent 0747078 commit c75d813

File tree

4 files changed

+7502
-9
lines changed

4 files changed

+7502
-9
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: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
const repeatString = function() {
2-
1+
const repeatString = function(string, numRepeat) {
2+
let outputString = "";
3+
for (let i=1; i<=numRepeat; i++){
4+
outputString += string;
5+
}
6+
return(outputString);
37
};
48

59
// Do not edit below this line

03_reverseString/reverseString.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
const reverseString = function() {
2-
1+
const reverseString = function(string) {
2+
let stringArray = string.split("")
3+
let resultString = "";
4+
for(let i = 1; i<=stringArray.length; i++){
5+
resultString += stringArray.pop();
6+
}
7+
return reverseString
38
};
49

510
// Do not edit below this line

0 commit comments

Comments
 (0)
0