Skip to content

Commit bc3f04d

Browse files
jamesjose03jamesgeorge007
authored andcommitted
JS Tasks Addition (#41)
* feat: Addition of tasks 13-15 * feat: Addition of tasks 16-18 * feat: Addition of Tasks 19-25 * feat: addition of Tasks 26-30 * fix: lint
1 parent acb0633 commit bc3f04d

File tree

20 files changed

+248
-5
lines changed

20 files changed

+248
-5
lines changed

package-lock.json

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let no = [45, 23, 767, 921];
2+
3+
for (let i = 0; i < no.length; i++) {
4+
if (no[i] > 23) console.log(no[i]);
5+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
let a = ['ABC', 'GHI', 'DEF', 'JKL'];
2+
let b = [1, 2, 3];
3+
a.pop();
4+
console.log(a);
5+
a.push('PQR');
6+
console.log(a);
7+
a.shift();
8+
console.log(a);
9+
a.splice(1, 2, 'WER', 'ERT');
10+
console.log(a);
11+
a = a.concat(b);
12+
console.log(a);
13+
a.sort();
14+
console.log(a);
15+
a.reverse();
16+
console.log(a);
17+
let c = b.map(element => {
18+
return 2 * element;
19+
});
20+
console.log(c);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let person = {
2+
age: 75,
3+
gender: 'female',
4+
};
5+
6+
let yyyy = 2019 - person.age;
7+
console.log(yyyy);
8+
console.log(person.gender);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
console.log(Math.round(5.57));
2+
console.log(Math.pow(6, 3));
3+
console.log(Math.sqrt(841));
4+
console.log(Math.ceil(5.3));
5+
console.log(Math.floor(5.3));
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
let day;
2+
switch (new Date().getDay()) {
3+
case 0:
4+
day = 'Sunday';
5+
break;
6+
case 1:
7+
day = 'Monday';
8+
break;
9+
case 2:
10+
day = 'Tuesday';
11+
break;
12+
case 3:
13+
day = 'Wednesday';
14+
break;
15+
case 4:
16+
day = 'Thursday';
17+
break;
18+
case 5:
19+
day = 'Friday';
20+
break;
21+
case 6:
22+
day = 'Saturday';
23+
}
24+
console.log(day);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let a = true.toString();
2+
let b = false.toString();
3+
console.log(typeof a);
4+
console.log(typeof b);
5+
let c = true;
6+
let d = false;
7+
console.log(typeof c);
8+
console.log(typeof d);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let a = 10;
2+
function abc() {
3+
let a = 4;
4+
console.log(a);
5+
}
6+
7+
abc();
8+
console.log(a);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const pounds = [11.21, 19.21, 46.21];
2+
3+
const sum = pounds.reduce((total, amount) => total + amount);
4+
5+
console.log(sum);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const numbers = [1, 3, 4, 6, 8, 9];
2+
3+
const filterValues = () => {
4+
return numbers.filter(number => {
5+
return number % 2 === 0;
6+
});
7+
};
8+
9+
console.log(filterValues());

0 commit comments

Comments
 (0)