-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
1 parent
acb0633
commit bc3f04d
Showing
20 changed files
with
248 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let no = [45, 23, 767, 921]; | ||
|
||
for (let i = 0; i < no.length; i++) { | ||
if (no[i] > 23) console.log(no[i]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
let a = ['ABC', 'GHI', 'DEF', 'JKL']; | ||
let b = [1, 2, 3]; | ||
a.pop(); | ||
console.log(a); | ||
a.push('PQR'); | ||
console.log(a); | ||
a.shift(); | ||
console.log(a); | ||
a.splice(1, 2, 'WER', 'ERT'); | ||
console.log(a); | ||
a = a.concat(b); | ||
console.log(a); | ||
a.sort(); | ||
console.log(a); | ||
a.reverse(); | ||
console.log(a); | ||
let c = b.map(element => { | ||
return 2 * element; | ||
}); | ||
console.log(c); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let person = { | ||
age: 75, | ||
gender: 'female', | ||
}; | ||
|
||
let yyyy = 2019 - person.age; | ||
console.log(yyyy); | ||
console.log(person.gender); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
console.log(Math.round(5.57)); | ||
console.log(Math.pow(6, 3)); | ||
console.log(Math.sqrt(841)); | ||
console.log(Math.ceil(5.3)); | ||
console.log(Math.floor(5.3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
let day; | ||
switch (new Date().getDay()) { | ||
case 0: | ||
day = 'Sunday'; | ||
break; | ||
case 1: | ||
day = 'Monday'; | ||
break; | ||
case 2: | ||
day = 'Tuesday'; | ||
break; | ||
case 3: | ||
day = 'Wednesday'; | ||
break; | ||
case 4: | ||
day = 'Thursday'; | ||
break; | ||
case 5: | ||
day = 'Friday'; | ||
break; | ||
case 6: | ||
day = 'Saturday'; | ||
} | ||
console.log(day); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let a = true.toString(); | ||
let b = false.toString(); | ||
console.log(typeof a); | ||
console.log(typeof b); | ||
let c = true; | ||
let d = false; | ||
console.log(typeof c); | ||
console.log(typeof d); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
let a = 10; | ||
function abc() { | ||
let a = 4; | ||
console.log(a); | ||
} | ||
|
||
abc(); | ||
console.log(a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const pounds = [11.21, 19.21, 46.21]; | ||
|
||
const sum = pounds.reduce((total, amount) => total + amount); | ||
|
||
console.log(sum); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const numbers = [1, 3, 4, 6, 8, 9]; | ||
|
||
const filterValues = () => { | ||
return numbers.filter(number => { | ||
return number % 2 === 0; | ||
}); | ||
}; | ||
|
||
console.log(filterValues()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let a = [3, 9, 12, 15, 18]; | ||
console.log(a.indexOf(15, 2)); | ||
console.log(a.indexOf(14, 1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
let obj = { | ||
name: 'ABC', | ||
education: 'CSE', | ||
}; | ||
console.log(Object.keys(obj)); | ||
let arr = ['A', 'B', 'C']; | ||
console.log(Object.keys(arr)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
let text = '{ "name":"John", "age":"39", "city":"New York"}'; | ||
let obj = JSON.parse(text, function(key, value) { | ||
if (key === 'city') { | ||
return value.toUpperCase(); | ||
} else { | ||
return value; | ||
} | ||
}); | ||
|
||
console.log(obj); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(JSON.stringify({ x: 5, y: 6 })); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
let goals = ['Mission', 'Vision', 'Dedication']; | ||
console.log(goals.includes('Mission')); | ||
console.log(goals.includes('Success')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const array1 = ['abc', 'bcd', 'cde']; | ||
|
||
array1.forEach(item => console.log(item)); | ||
for (const element of array1) { | ||
console.log(element); | ||
} | ||
for (const index in array1) { | ||
console.log(index); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let str = 'JS is AWESOME!'; | ||
let arr = str.split(' '); | ||
console.log(arr); | ||
let a = ['I', 'love', 'JS!']; | ||
let s = a.join(' '); | ||
console.log(s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
let str = 'Hello, I am a novice JS Developer.'; | ||
console.log(str.startsWith('Hello')); | ||
console.log(str.endsWith('Develop')); | ||
let str1 = 'I am a Polyglot'; | ||
console.log(str1.substr(str1.indexOf('P'), str1.indexOf('t'))); | ||
console.log(str1.substring(str1.indexOf('a'), str1.indexOf('t') + 1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
let counter = 0; | ||
|
||
const startCounter = () => { | ||
counter++; | ||
process.stdout.write(`${counter} `); | ||
}; | ||
|
||
const interval = setInterval(startCounter, 1000); | ||
|
||
setTimeout(() => clearInterval(interval), 6000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters