Skip to content

Commit 88c2d3c

Browse files
committed
week one exercise is done
1 parent 0f0722c commit 88c2d3c

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
/**
22
* We want to remove the comma's in the given string (myString), replace them with a space and log it to the console.
3-
*
4-
* The end result should be:
3+
*
4+
* The end result should be:
55
* hello this is a difficult to read sentence
66
*/
77

88
let myString = 'hello,this,is,a,difficult,to,read,sentence';
99

10-
10+
// solution 1
11+
myString = myString.replaceAll(',', ' ');
12+
// solution 2
13+
// myString = myString.split(',').join(' ');
1114

1215
/* --- Code that will test your solution, do NOT change. Write above this line --- */
1316

14-
console.assert(myString === 'hello this is a difficult to read sentence', 'There is something wrong with your solution');
17+
console.assert(
18+
myString === 'hello this is a difficult to read sentence',
19+
'There is something wrong with your solution'
20+
);

Week1/practice-exercises/2-even-odd-reporter.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@
66
* If it's odd, log to the console The number [PUT_NUMBER_HERE] is odd!.
77
* If it's even, log to the console The number [PUT_NUMBER_HERE] is even!.
88
*/
9-
9+
for (let number = 0; number <= 20; number++) {
10+
number % 2 == 0
11+
? console.log(`The number ${number} is Even!`)
12+
: console.log(`The number ${number} is odd!`);
13+
}

0 commit comments

Comments
 (0)