Skip to content

Commit 6c3c48c

Browse files
committed
Functions
1 parent 565f960 commit 6c3c48c

File tree

2 files changed

+61
-5
lines changed

2 files changed

+61
-5
lines changed

functions/try-it/isPalindrome.js

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,50 @@
1-
function reverse(str) {
2-
return str.split('').reverse().join('');
3-
}
1+
// function reverse(str) {
2+
// return str.split('').reverse().join('');
3+
// }
4+
5+
// function isPalindrome(str) {
6+
// return reverse(str) === str;
7+
// }
8+
9+
10+
// function sayHello() {
11+
// console.log("Hello, World!");
12+
// }
13+
14+
// sayHello();
15+
16+
// function sumToN(n) {
17+
// let sum = 0;
18+
// for (let i = 0; i <= n; i++) {
19+
// sum += i;
20+
// }
21+
// return sum;
22+
// }
23+
24+
// console.log(sumToN(3));
425

5-
function isPalindrome(str) {
6-
return reverse(str) === str;
26+
// function plusTwo(num) {
27+
// return num + 2;
28+
// }
29+
30+
// let a = 2;
31+
32+
// for (let i=0; i < 4; i++) {
33+
// a = plusTwo(a);
34+
// }
35+
36+
// console.log(a);
37+
38+
// function repeater(str) {
39+
// let repeated = str + str;
40+
// console.log(repeated);
41+
// }
42+
43+
// repeater('Bob');
44+
45+
function repeater(str) {
46+
let repeated = str + str;
47+
console.log(repeated);
748
}
49+
50+
repeater('Bob');

functions/try-it/sayHello.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
function sayHello() {
22
console.log("Hello, World!");
33
}
4+
5+
6+
7+
// let num = 42;
8+
9+
// function isEven (num) {
10+
// return num % 2 === 0;
11+
// }
12+
13+
// console.log(isEven(43));
14+
15+
16+

0 commit comments

Comments
 (0)