-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2a9dd1
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
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,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "pwa-node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${file}" | ||
} | ||
] | ||
} |
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,13 @@ | ||
// Remember, the Date constructor takes a zero-based month number, so a | ||
// month value of 10 corresponds to the eleventh month, November | ||
const dates = [new Date(2021, 10, 20), new Date(2020, 3, 12), | ||
new Date(2020, 5, 23), new Date(2022, 3, 18)]; | ||
// Find the first date in 2020 | ||
/* const matchingDate = dates.find(date => date.getFullYear() === 2020); | ||
console.log(matchingDate); */ | ||
|
||
function matchingDate (dates, year){ | ||
return dates.find(date => date.getFullYear() === year); | ||
} | ||
|
||
console.log(matchingDate(dates,2020));//Sun Apr 12 2020 00:00:00 GMT+0700 (Western Indonesia Time) |
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 @@ | ||
const numbers = [44,131,335,223,21,66,87]; | ||
// This syntax is not allowed. The result is NaN. | ||
|
||
function maxNumber(arrays){ | ||
return Math.max(...numbers) | ||
} | ||
|
||
console.log(maxNumber(numbers)); |
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,15 @@ | ||
// terdapat array employees | ||
const cities = ["merak", "tangerang", "jakarta", "bogor", "cianjur", "cimahi", "bandung"]; | ||
|
||
const bogor = cities.indexOf("bogor") | ||
|
||
const citiesSliced = [...cities.slice(0, bogor), ...cities.slice(bogor + 1)] | ||
|
||
function citiesSlice(arrays, cityBetween) { | ||
const jakarta=arrays.indexOf(cityBetween); | ||
const citiesSliced2 = [...arrays.slice(0, jakarta), ...arrays.slice(jakarta + 1)] | ||
return citiesSliced2; | ||
} | ||
|
||
console.log(citiesSlice(cities,"jakarta")); | ||
//['merak', 'tangerang', 'bogor', 'cianjur', 'cimahi', 'bandung'] |