From 2a9c5ced6cb11f9a063eaf96fd7421be9a78a7ad Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 6 Dec 2022 15:03:42 +0000
Subject: [PATCH 01/19] Bump qs in
/Asynchronous-JavaScript/Asynchronous-Example
Bumps [qs](https://github.com/ljharb/qs) from 6.9.0 to 6.11.0.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ljharb/qs/compare/v6.9.0...v6.11.0)
---
updated-dependencies:
- dependency-name: qs
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
---
.../Asynchronous-Example/package-lock.json | 61 ++++++++++++++++++-
1 file changed, 58 insertions(+), 3 deletions(-)
diff --git a/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json b/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
index 460ab26..21d3c2a 100644
--- a/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
+++ b/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
@@ -9,6 +9,15 @@
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
+ "call-bind": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
+ "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
+ "requires": {
+ "function-bind": "^1.1.1",
+ "get-intrinsic": "^1.0.2"
+ }
+ },
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -60,6 +69,34 @@
"resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz",
"integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg=="
},
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ },
+ "get-intrinsic": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
+ "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
+ "requires": {
+ "function-bind": "^1.1.1",
+ "has": "^1.0.3",
+ "has-symbols": "^1.0.3"
+ }
+ },
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
+ "has-symbols": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
+ "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
+ },
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@@ -93,10 +130,18 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
+ "object-inspect": {
+ "version": "1.12.2",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
+ "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ=="
+ },
"qs": {
- "version": "6.9.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.0.tgz",
- "integrity": "sha512-27RP4UotQORTpmNQDX8BHPukOnBP3p1uUJY5UnDhaJB+rMt9iMsok724XL+UHU23bEFOHRMQ2ZhI99qOWUMGFA=="
+ "version": "6.11.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
+ "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
+ "requires": {
+ "side-channel": "^1.0.4"
+ }
},
"readable-stream": {
"version": "3.4.0",
@@ -118,6 +163,16 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
},
+ "side-channel": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
+ "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
+ "requires": {
+ "call-bind": "^1.0.0",
+ "get-intrinsic": "^1.0.2",
+ "object-inspect": "^1.9.0"
+ }
+ },
"string_decoder": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
From 05a0092c93c95603a083a7453b7eb64feb199bcb Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: 2023年1月24日 01:03:01 +0000
Subject: [PATCH 02/19] Bump cookiejar in
/Asynchronous-JavaScript/Asynchronous-Example
Bumps [cookiejar](https://github.com/bmeck/node-cookiejar) from 2.1.2 to 2.1.4.
- [Release notes](https://github.com/bmeck/node-cookiejar/releases)
- [Commits](https://github.com/bmeck/node-cookiejar/commits)
---
updated-dependencies:
- dependency-name: cookiejar
dependency-type: indirect
...
Signed-off-by: dependabot[bot]
---
.../Asynchronous-Example/package-lock.json | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json b/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
index 460ab26..9d95da4 100644
--- a/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
+++ b/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
@@ -23,9 +23,9 @@
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
},
"cookiejar": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz",
- "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz",
+ "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw=="
},
"debug": {
"version": "4.1.1",
From c18df604b49321c51483f8570ce663ab3a5f6cf6 Mon Sep 17 00:00:00 2001
From: Lakshman
Date: 2023年2月25日 11:17:57 +0600
Subject: [PATCH 03/19] Find non negative duplicates and how many times
---
Interview-Questions/findDuplicates.js | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 Interview-Questions/findDuplicates.js
diff --git a/Interview-Questions/findDuplicates.js b/Interview-Questions/findDuplicates.js
new file mode 100644
index 0000000..efd659d
--- /dev/null
+++ b/Interview-Questions/findDuplicates.js
@@ -0,0 +1,22 @@
+// Find non negative duplicates and how many times
+
+let array = [1, 4, -1, 8, 2, 4, 4, 4, 1, -1, 6, 2, 1, 9, 7];
+function findDuplicates(arr) {
+ let duplicateElements = {};
+ arr.forEach((currentValue, currentIndex) => {
+
+ // return currentValue> 0 && arr.indexOf(currentValue) !== currentIndex; // return non negative and duplicate elements
+
+ // find how many times
+ if(currentValue> 0 && arr.indexOf(currentValue) !== currentIndex){
+ duplicateElements[currentValue] = (duplicateElements[currentValue] || 1) + 1;
+ }
+
+ // console.log(currentValue, currentIndex, arr.indexOf(currentValue))
+ });
+
+
+ return duplicateElements;
+}
+
+console.log(findDuplicates(array), Object.keys(findDuplicates(array)));
From 3b53b772d25a10f9a952474a53d27cbaff811524 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: 2023年6月25日 10:35:13 +0000
Subject: [PATCH 04/19] Bump semver and superagent
Bumps [semver](https://github.com/npm/node-semver) to 7.5.3 and updates ancestor dependency [superagent](https://github.com/ladjs/superagent). These dependencies need to be updated together.
Updates `semver` from 6.3.0 to 7.5.3
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v7.5.3)
Updates `superagent` from 5.1.0 to 5.3.1
- [Release notes](https://github.com/ladjs/superagent/releases)
- [Changelog](https://github.com/ladjs/superagent/blob/master/HISTORY.md)
- [Commits](https://github.com/ladjs/superagent/compare/v5.1.0...v5.3.1)
---
updated-dependencies:
- dependency-name: semver
dependency-type: indirect
- dependency-name: superagent
dependency-type: direct:production
...
Signed-off-by: dependabot[bot]
---
.../Asynchronous-Example/package-lock.json | 134 ++++++++++--------
.../Asynchronous-Example/package.json | 2 +-
2 files changed, 79 insertions(+), 57 deletions(-)
diff --git a/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json b/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
index 3641dd5..7bd2b13 100644
--- a/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
+++ b/Asynchronous-JavaScript/Asynchronous-Example/package-lock.json
@@ -7,7 +7,7 @@
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"call-bind": {
"version": "1.0.2",
@@ -37,37 +37,37 @@
"integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw=="
},
"debug": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
- "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
- "ms": "^2.1.1"
+ "ms": "2.1.2"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"fast-safe-stringify": {
- "version": "2.0.7",
- "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz",
- "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA=="
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
+ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="
},
"form-data": {
- "version": "2.5.1",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
- "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
+ "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"requires": {
"asynckit": "^0.4.0",
- "combined-stream": "^1.0.6",
+ "combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"formidable": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz",
- "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg=="
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz",
+ "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ=="
},
"function-bind": {
"version": "1.1.1",
@@ -75,12 +75,13 @@
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
},
"get-intrinsic": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
- "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
+ "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
+ "has-proto": "^1.0.1",
"has-symbols": "^1.0.3"
}
},
@@ -92,6 +93,11 @@
"function-bind": "^1.1.1"
}
},
+ "has-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
+ "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg=="
+ },
"has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
@@ -102,27 +108,35 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
+ "lru-cache": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
+ "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
+ "requires": {
+ "yallist": "^4.0.0"
+ }
+ },
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
- "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w=="
},
"mime": {
- "version": "2.4.4",
- "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
- "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA=="
+ "version": "2.6.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
+ "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg=="
},
"mime-db": {
- "version": "1.40.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
- "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
- "version": "2.1.24",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
- "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"requires": {
- "mime-db": "1.40.0"
+ "mime-db": "1.52.0"
}
},
"ms": {
@@ -131,22 +145,22 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"object-inspect": {
- "version": "1.12.2",
- "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
- "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ=="
+ "version": "1.12.3",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
+ "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g=="
},
"qs": {
- "version": "6.11.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
- "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
+ "version": "6.11.2",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz",
+ "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==",
"requires": {
"side-channel": "^1.0.4"
}
},
"readable-stream": {
- "version": "3.4.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
- "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"requires": {
"inherits": "^2.0.3",
"string_decoder": "^1.1.1",
@@ -154,14 +168,17 @@
}
},
"safe-buffer": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
- "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
},
"semver": {
- "version": "6.3.0",
- "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
- "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ "version": "7.5.3",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz",
+ "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==",
+ "requires": {
+ "lru-cache": "^6.0.0"
+ }
},
"side-channel": {
"version": "1.0.4",
@@ -182,27 +199,32 @@
}
},
"superagent": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.1.0.tgz",
- "integrity": "sha512-7V6JVx5N+eTL1MMqRBX0v0bG04UjrjAvvZJTF/VDH/SH2GjSLqlrcYepFlpTrXpm37aSY6h3GGVWGxXl/98TKA==",
+ "version": "5.3.1",
+ "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.3.1.tgz",
+ "integrity": "sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==",
"requires": {
"component-emitter": "^1.3.0",
"cookiejar": "^2.1.2",
"debug": "^4.1.1",
- "fast-safe-stringify": "^2.0.6",
- "form-data": "^2.3.3",
- "formidable": "^1.2.1",
+ "fast-safe-stringify": "^2.0.7",
+ "form-data": "^3.0.0",
+ "formidable": "^1.2.2",
"methods": "^1.1.2",
- "mime": "^2.4.4",
- "qs": "^6.7.0",
- "readable-stream": "^3.4.0",
- "semver": "^6.1.1"
+ "mime": "^2.4.6",
+ "qs": "^6.9.4",
+ "readable-stream": "^3.6.0",
+ "semver": "^7.3.2"
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
+ },
+ "yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
}
}
}
diff --git a/Asynchronous-JavaScript/Asynchronous-Example/package.json b/Asynchronous-JavaScript/Asynchronous-Example/package.json
index e5de3c6..b5b70ef 100644
--- a/Asynchronous-JavaScript/Asynchronous-Example/package.json
+++ b/Asynchronous-JavaScript/Asynchronous-Example/package.json
@@ -17,6 +17,6 @@
},
"homepage": "https://github.com/Lakshmangope/node.js#readme",
"dependencies": {
- "superagent": "^5.1.0"
+ "superagent": "^5.3.1"
}
}
From c34b09f9df6f1a2283578efbb529c612a4305be4 Mon Sep 17 00:00:00 2001
From: Lakshman Gope
Date: 2023年11月22日 12:29:09 +0600
Subject: [PATCH 05/19] Create output.js
---
Interview-Questions/output.js | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 Interview-Questions/output.js
diff --git a/Interview-Questions/output.js b/Interview-Questions/output.js
new file mode 100644
index 0000000..6ba076f
--- /dev/null
+++ b/Interview-Questions/output.js
@@ -0,0 +1,5 @@
+// 1) What is the output of 10+20+"30" in JavaScript?
+//Ans: 3030 because 10+20 will be 30. If there is numeric value before and after +, it treats as binary + (arithmetic operator).
+
+// 2) What is the output of "10"+20+30 in JavaScript?
+// Ans: 102030 because after a string all the + will be treated as string concatenation operator (not binary +).
From df85cf90b6cb8798de4c730ffbe99213a55e5a00 Mon Sep 17 00:00:00 2001
From: Lakshman Gope
Date: 2023年11月22日 23:11:39 +0600
Subject: [PATCH 06/19] Update output.js
---
Interview-Questions/output.js | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/Interview-Questions/output.js b/Interview-Questions/output.js
index 6ba076f..132ca0f 100644
--- a/Interview-Questions/output.js
+++ b/Interview-Questions/output.js
@@ -3,3 +3,20 @@
// 2) What is the output of "10"+20+30 in JavaScript?
// Ans: 102030 because after a string all the + will be treated as string concatenation operator (not binary +).
+
+// 3) Output?
+// Syncronous
+[1, 2, 3, 4].forEach((i) => {
+ console.log(i)
+})
+
+// Asynchronous
+function asyncForEach(array, cb) {
+ array.forEach(() => {
+ setTimeout(cb, 0);
+ })
+}
+
+asyncForEach([1, 2, 3, 4], (i) => {
+ console.log(i);
+})
From ec7592722c40a00f75f0eb31f43c67e5c85bb036 Mon Sep 17 00:00:00 2001
From: lgope
Date: 2023年11月24日 12:21:22 +0600
Subject: [PATCH 07/19] updated to es6
---
01 - JavaScript-Basics/Arrays.js | 8 ++++----
01 - JavaScript-Basics/Functions2.js | 2 +-
01 - JavaScript-Basics/emailValidate.js | 3 ++-
algorithms/binarySearchRecursive.js | 18 ++++++++----------
4 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/01 - JavaScript-Basics/Arrays.js b/01 - JavaScript-Basics/Arrays.js
index 5462575..6813489 100644
--- a/01 - JavaScript-Basics/Arrays.js
+++ b/01 - JavaScript-Basics/Arrays.js
@@ -1,6 +1,6 @@
// Initialize new array
-var names = ['John', 'Mark', 'Jane'];
-var years = new Array(1990, 1969, 1948);
+let names = ['John', 'Mark', 'Jane'];
+let years = new Array(1990, 1969, 1948);
console.log(names[2]); // Jane
console.log(names.length); // 3
@@ -11,7 +11,7 @@ names[names.length] = 'Mary';
console.log(names);
// Different data types
-var john = ['John', 'Smith', 1990, 'designer', false];
+let john = ['John', 'Smith', 1990, 'designer', false];
john.push('blue'); // last input
john.unshift('Mr.'); // first input
@@ -25,5 +25,5 @@ console.log(john);
console.log(john.indexOf(23)); // -1 [because there is no such index.]
// Ternary Operator
-var isDesigner = john.indexOf('designer') === -1 ? 'John is NOT a designer' : 'John IS a designer';
+let isDesigner = john.indexOf('designer') === -1 ? 'John is NOT a designer' : 'John IS a designer';
console.log(isDesigner); // John IS a designer
\ No newline at end of file
diff --git a/01 - JavaScript-Basics/Functions2.js b/01 - JavaScript-Basics/Functions2.js
index 7ceb85c..23826cf 100644
--- a/01 - JavaScript-Basics/Functions2.js
+++ b/01 - JavaScript-Basics/Functions2.js
@@ -8,7 +8,7 @@
// Function expression
-var whatDoYouDo = function (job, firstName) {
+const whatDoYouDo = (job, firstName) => {
switch (job) {
case 'teacher':
return firstName + ' teaches kids how to code';
diff --git a/01 - JavaScript-Basics/emailValidate.js b/01 - JavaScript-Basics/emailValidate.js
index dc3934e..f5da06f 100644
--- a/01 - JavaScript-Basics/emailValidate.js
+++ b/01 - JavaScript-Basics/emailValidate.js
@@ -1,4 +1,5 @@
-function validateEmail(email) {
+// email regex
+const validateEmail = (email) => {
const re = /^(([^()\[\]\\.,;:\s@"]+(\.[^()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
diff --git a/algorithms/binarySearchRecursive.js b/algorithms/binarySearchRecursive.js
index 026430b..349b6d9 100644
--- a/algorithms/binarySearchRecursive.js
+++ b/algorithms/binarySearchRecursive.js
@@ -1,19 +1,17 @@
-function binarySearch(arr, val, start = 0, end = arr.length - 1) {
+const binarySearch = (arr, val, start = 0, end = arr.length - 1) => {
const mid = Math.floor((start + end) / 2);
- if (val === arr[mid]) {
- return mid;
- }
+ if (val === arr[mid]) return mid;
- if (start>= end) {
- return -1;
- }
+ if (start>= end) return -1;
return val < arr[mid] ? binarySearch(arr, val, start, mid - 1) : binarySearch(arr, val, mid + 1, end); -} +}; -let arr = [1, 2, 4, 6, 100, 10000]; +const arr = [1, 9, 5, 7, 2, 4, 8, 6].sort(); -console.log(binarySearch(arr, 2)); +const result = binarySearch(arr, 2); + +console.log(result !== -1 ? `Element is present at index ${result}` : 'Element is not present in array'); From 6b2f05b7f2c035f9004d2b9413a109d42e1dd334 Mon Sep 17 00:00:00 2001 From: lgope
Date: 2023年11月24日 14:22:35 +0600
Subject: [PATCH 08/19] es10 and output ques updated
---
ES10-or-ECMAScript2019/basicOfES10.js | 77 ++++++++++++++++++++++++---
1 file changed, 70 insertions(+), 7 deletions(-)
diff --git a/ES10-or-ECMAScript2019/basicOfES10.js b/ES10-or-ECMAScript2019/basicOfES10.js
index 9015bf9..98b2ee0 100644
--- a/ES10-or-ECMAScript2019/basicOfES10.js
+++ b/ES10-or-ECMAScript2019/basicOfES10.js
@@ -5,16 +5,16 @@ console.log(array.flat(2)); // [ 1, 2, 3, [ 4 ], [ 5 ] ]
// #2 Turning this array into a new array: [ 'Hello young grasshopper!', 'you are', 'learning fast!' ]
const greeting = [
- ['Hello', 'young', 'grasshopper!'],
- ['you', 'are'],
- ['learning', 'fast!']
+ ["Hello", "young", "grasshopper!"],
+ ["you", "are"],
+ ["learning", "fast!"],
];
-console.log(greeting.flatMap(x => x.join(' '))); // [ 'Hello young grasshopper!', 'you are', 'learning fast!' ]
+console.log(greeting.flatMap((x) => x.join(" "))); // [ 'Hello young grasshopper!', 'you are', 'learning fast!' ]
//#3 Turning the greeting array above into a string: 'Hello young grasshopper you are learning fast!'
-console.log(greeting.flatMap(x => x.join(' ')).join(' ')); // Hello young grasshopper! you are learning fast!
+console.log(greeting.flatMap((x) => x.join(" ")).join(" ")); // Hello young grasshopper! you are learning fast!
//#4 Turning the trapped 3 number into: [3]
const trapped = [[[[[[[[[[[[[[[[[[[[[[[[[[3]]]]]]]]]]]]]]]]]]]]]]]]]];
@@ -23,7 +23,7 @@ console.log(trapped.flat(Infinity)); // [ 3 ]
// Infintiy is actually a LARGE number in JavaScipt. It represents the maximum amount of memory that we can hold for a number! For more here: https://riptutorial.com/javascript/example/2337/infinity-and--infinity
//#5 Cleaning up this email to have no whitespaces. Make the answer be in a single line (return a new string):
-const userEmail3 = ' cannotfillemailformcorrectly@gmail.com ';
+const userEmail3 = " cannotfillemailformcorrectly@gmail.com ";
console.log(userEmail3.trimEnd().trimStart()); // cannotfillemailformcorrectly@gmail.com
@@ -34,9 +34,72 @@ const usersArray = Object.entries(users);
//#7 changing the output array of the above to have the user's IDs multiplied by 2 -- Should output:[ [ 'user1', 36546 ], [ 'user2', 185666 ], [ 'user3', 180630 ] ]
-updatedUsersArray = usersArray.map(user => [user[0], user[1] * 2]);
+updatedUsersArray = usersArray.map((user) => [user[0], user[1] * 2]);
//#8 changing the output array of #7 back into an object with all the users IDs updated to their new version. Should output: { user1: 36546, user2: 185666, user3: 180630 }
const updatedUsers = Object.fromEntries(updatedUsersArray);
console.log(updatedUsers); // { user1: 36546, user2: 185666, user3: 180630 }
+
+// Array.flat() && Array.flatMap
+const jobs = [
+ ["👮🏻", "💂🏻"],
+ ["👷🏻♂️", "🤴🏻"],
+];
+const flatJobs = jobs.flat(); // same as: const flatJobs = jobs.flat(1);
+
+console.log(flatJobs); // ['👮🏻', '💂🏻', '👷🏻♂️', '🤴🏻']
+
+const jobsList = [
+ ["👮🏻", "💂🏻"],
+ ["👷🏻♂️", "🤴🏻", ["🎅🏻", ["🦸🏻"], "🦹🏻♀️"]],
+];
+const flatJobsList = jobsList.flat(Infinity); // Infinity: flatten an array of arbitrary depth
+
+console.log(flatJobsList); // ['👮🏻', '💂🏻', '👷🏻♂️', '🤴🏻', '🎅🏻', '🦸🏻', '🦹🏻♀️']
+
+const names = ["police", "guard", "builder", "princess"];
+
+const mappedOnly = flatJobs.map((job, index) => [job, names[index]]);
+const mappedAndFlatten = flatJobs.flatMap((job, index) => [job, names[index]]);
+
+console.log(mappedOnly); // [['👮🏻', 'police'], ['💂🏻', 'guard'], ['👷🏻♂️', 'builder'], ['🤴🏻', 'princess']]
+console.log(mappedAndFlatten); // ['👮🏻', 'police', '💂🏻', 'guard', '👷🏻♂️', 'builder', '🤴🏻', 'princess']
+
+// From Entries
+const fruits = { lemon: "🍋", pineapple: "🍍", mango: "🥭", apple: "🍏" };
+const entries = Object.entries(fruits);
+
+console.log(Object.entries(fruits)); // [['lemon', '🍋'],['pineapple', '🍍'],['mango', '🥭'],['apple', '🍏']]
+console.log(Object.fromEntries(entries)); // {lemon: '🍋', pineapple: '🍍', mango: '🥭', apple: '🍏'}
+
+// String.trimStart() & String.trimEnd()
+const fruitsList = " 🥭🍏🍍 ";
+console.log(fruitsList.trimEnd()); // " 🥭🍏🍍";
+console.log(fruitsList.trimStart()); // "🥭🍏🍍 ";
+
+// Stable Array.prototype.sort()
+const fruitsArr = [
+ { name: "🥝", units: 12 },
+ { name: "🫐", units: 14 },
+ { name: "🍏", units: 16 },
+ { name: "🥬", units: 15 },
+ { name: "🍊", units: 18 },
+ { name: "🍐", units: 19 },
+];
+
+// Create our own sort criteria function:
+const sortCriteria = (fruit1, fruit2) => fruit1.units - fruit2.units;
+
+// Perform stable ES10 sort:
+const sorted = fruitsArr.sort(sortCriteria);
+
+console.log(sorted);
+// [
+// { name: "🥝", units: 12 },
+// { name: "🫐", units: 14 },
+// { name: "🥬", units: 15 },
+// { name: "🍏", units: 16 },
+// { name: "🍊", units: 18 },
+// { name: "🍐", units: 19 },
+// ];
From ee2c0aa305750f08694c4d68080d9d3f074fb73c Mon Sep 17 00:00:00 2001
From: lgope
Date: 2023年11月24日 14:24:25 +0600
Subject: [PATCH 09/19] es10 and output ques updated
---
.../Access-From-DOM/index.html | 11 ++++-
.../Access-From-DOM/scripts.js | 46 +++++++++---------
.../Access-From-DOM/shawon.jpg | Bin 93190 -> 0 bytes
Interview-Questions/output.js | 13 +++++
4 files changed, 46 insertions(+), 24 deletions(-)
delete mode 100644 DOM-Manipulation-And-Events/Access-From-DOM/shawon.jpg
diff --git a/DOM-Manipulation-And-Events/Access-From-DOM/index.html b/DOM-Manipulation-And-Events/Access-From-DOM/index.html
index 88704cc..28baa86 100644
--- a/DOM-Manipulation-And-Events/Access-From-DOM/index.html
+++ b/DOM-Manipulation-And-Events/Access-From-DOM/index.html
@@ -40,6 +40,15 @@ Article 003
asperiores odio est? Doloribus atque laborum pariatur fugit alias sunt possimus neque beatae,
unde dolorum nisi non minima!
+
+
+ Article 004
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Neque pariatur molestias minus. Quia
+ ullam voluptas laboriosam reprehenderit quisquam dolores dignissimos magni fuga dolor, animi
+ voluptatem temporibus maiores totam facere eum odit sint, consequatur eveniet inventore cum
+ officiis. At, sint voluptates exercitationem, quidem obcaecati id molestias cum dignissimos
+ velit possimus nisi.
+