diff --git a/client/i18n/locales/english/intro.json b/client/i18n/locales/english/intro.json index 7aab17c6e9e..93322aed241 100644 --- a/client/i18n/locales/english/intro.json +++ b/client/i18n/locales/english/intro.json @@ -1736,7 +1736,7 @@ "form-validation": "Form Validation", "javascript-dates": "Dates", "audio-and-video-events": "Audio and Video Events", - "maps-sets-and-json": "Maps and Sets", + "maps-and-sets": "Maps and Sets", "localstorage-and-crud-operations": "localStorage and CRUD Operations", "classes-and-the-this-keyword": "Classes", "recursion": "Recursion", @@ -3097,16 +3097,17 @@ }, "cvsw": { "title": "226", "intro": [] }, "cvs1": { "title": "227", "intro": [] }, - "review-javascript-maps-sets-and-json": { - "title": "JavaScript Maps, Sets, and JSON Review", + "review-javascript-maps-and-sets": { + "title": "JavaScript Maps and Sets Review", "intro": [ - "Review the JavaScript Maps, Sets, and JSON concepts to prepare for the upcoming quiz." + "Before you are quizzed on JS Maps and Sets, you first need to review.", + "Open up this page to review concepts such as the Map and Set objects, as well as WeakSet and WeakMap." ] }, - "quiz-javascript-maps-sets-and-json": { - "title": "JavaScript Maps, Sets, and JSON Quiz", + "quiz-javascript-maps-and-sets": { + "title": "JavaScript Maps and Sets Quiz", "intro": [ - "Test what you've learned in this quiz on JavaScript Maps, Sets, and JSON." + "Test what you've learned in this quiz on JavaScript Maps and Sets." ] }, "lecture-working-with-client-side-storage-and-crud-operations": { diff --git a/client/src/pages/learn/full-stack-developer/quiz-javascript-maps-and-sets/index.md b/client/src/pages/learn/full-stack-developer/quiz-javascript-maps-and-sets/index.md new file mode 100644 index 00000000000..64240fe7772 --- /dev/null +++ b/client/src/pages/learn/full-stack-developer/quiz-javascript-maps-and-sets/index.md @@ -0,0 +1,9 @@ +--- +title: Introduction to the JavaScript Maps and Sets Quiz +block: quiz-javascript-maps-and-sets +superBlock: full-stack-developer +--- + +## Introduction to the JavaScript Maps and Sets Quiz + +Test what you've learned in this quiz on JavaScript Maps and Sets. diff --git a/client/src/pages/learn/full-stack-developer/quiz-javascript-maps-sets-and-json/index.md b/client/src/pages/learn/full-stack-developer/quiz-javascript-maps-sets-and-json/index.md deleted file mode 100644 index 8f2659ecf00..00000000000 --- a/client/src/pages/learn/full-stack-developer/quiz-javascript-maps-sets-and-json/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Introduction to the JavaScript Maps, Sets, and JSON Quiz -block: quiz-javascript-maps-sets-and-json -superBlock: full-stack-developer ---- - -## Introduction to the JavaScript Maps, Sets, and JSON Quiz - -Test what you've learned in this quiz on JavaScript Maps, Sets, and JSON. diff --git a/client/src/pages/learn/full-stack-developer/review-javascript-maps-and-sets/index.md b/client/src/pages/learn/full-stack-developer/review-javascript-maps-and-sets/index.md new file mode 100644 index 00000000000..87fa39541ce --- /dev/null +++ b/client/src/pages/learn/full-stack-developer/review-javascript-maps-and-sets/index.md @@ -0,0 +1,9 @@ +--- +title: Introduction to the JavaScript Maps and Sets Review +block: review-javascript-maps-and-sets +superBlock: full-stack-developer +--- + +## Introduction to the JavaScript Maps and Sets Review + +Review the JavaScript Maps and Sets concepts to prepare for the upcoming quiz. diff --git a/client/src/pages/learn/full-stack-developer/review-javascript-maps-sets-and-json/index.md b/client/src/pages/learn/full-stack-developer/review-javascript-maps-sets-and-json/index.md deleted file mode 100644 index d9b206533b7..00000000000 --- a/client/src/pages/learn/full-stack-developer/review-javascript-maps-sets-and-json/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Introduction to the JavaScript Maps, Sets, and JSON Review -block: review-javascript-maps-sets-and-json -superBlock: full-stack-developer ---- - -## Introduction to the JavaScript Maps, Sets, and JSON Review - -Review the JavaScript Maps, Sets, and JSON concepts to prepare for the upcoming quiz. diff --git a/curriculum/challenges/_meta/quiz-javascript-maps-sets-and-json/meta.json b/curriculum/challenges/_meta/quiz-javascript-maps-and-sets/meta.json similarity index 59% rename from curriculum/challenges/_meta/quiz-javascript-maps-sets-and-json/meta.json rename to curriculum/challenges/_meta/quiz-javascript-maps-and-sets/meta.json index 177f7c79075..bf5345c88d1 100644 --- a/curriculum/challenges/_meta/quiz-javascript-maps-sets-and-json/meta.json +++ b/curriculum/challenges/_meta/quiz-javascript-maps-and-sets/meta.json @@ -1,14 +1,14 @@ { - "name": "JavaScript Maps, Sets, and JSON Quiz", + "name": "JavaScript Maps and Sets Quiz", "blockType": "quiz", "blockLayout": "link", "isUpcomingChange": true, - "dashedName": "quiz-javascript-maps-sets-and-json", + "dashedName": "quiz-javascript-maps-and-sets", "superBlock": "full-stack-developer", "challengeOrder": [ { "id": "67358be1c7903489c0a7db78", - "title": "JavaScript Maps, Sets, and JSON Quiz" + "title": "JavaScript Maps and Sets Quiz" } ], "helpCategory": "JavaScript" diff --git a/curriculum/challenges/_meta/review-javascript-maps-sets-and-json/meta.json b/curriculum/challenges/_meta/review-javascript-maps-and-sets/meta.json similarity index 58% rename from curriculum/challenges/_meta/review-javascript-maps-sets-and-json/meta.json rename to curriculum/challenges/_meta/review-javascript-maps-and-sets/meta.json index abe93ae98c4..8d51e263194 100644 --- a/curriculum/challenges/_meta/review-javascript-maps-sets-and-json/meta.json +++ b/curriculum/challenges/_meta/review-javascript-maps-and-sets/meta.json @@ -1,14 +1,14 @@ { - "name": "JavaScript Maps, Sets, and JSON Review", + "name": "JavaScript Maps and Sets Review", "blockType": "review", "blockLayout": "link", "isUpcomingChange": true, - "dashedName": "review-javascript-maps-sets-and-json", + "dashedName": "review-javascript-maps-and-sets", "superBlock": "full-stack-developer", "challengeOrder": [ { "id": "6723d027b02e4cc6ee5944da", - "title": "JavaScript Maps, Sets, and JSON Review" + "title": "JavaScript Maps and Sets Review" } ], "helpCategory": "JavaScript" diff --git a/curriculum/challenges/english/25-front-end-development/quiz-javascript-maps-sets-and-json/67358be1c7903489c0a7db78.md b/curriculum/challenges/english/25-front-end-development/quiz-javascript-maps-and-sets/67358be1c7903489c0a7db78.md similarity index 98% rename from curriculum/challenges/english/25-front-end-development/quiz-javascript-maps-sets-and-json/67358be1c7903489c0a7db78.md rename to curriculum/challenges/english/25-front-end-development/quiz-javascript-maps-and-sets/67358be1c7903489c0a7db78.md index 8efdef4566b..9f9c01a60e1 100644 --- a/curriculum/challenges/english/25-front-end-development/quiz-javascript-maps-sets-and-json/67358be1c7903489c0a7db78.md +++ b/curriculum/challenges/english/25-front-end-development/quiz-javascript-maps-and-sets/67358be1c7903489c0a7db78.md @@ -1,8 +1,8 @@ --- id: 67358be1c7903489c0a7db78 -title: JavaScript Maps, Sets, and JSON Quiz +title: JavaScript Maps and Sets Quiz challengeType: 8 -dashedName: quiz-javascript-maps-sets-and-json +dashedName: quiz-javascript-maps-and-sets --- # --description-- diff --git a/curriculum/challenges/english/25-front-end-development/review-javascript-maps-and-sets/6723d027b02e4cc6ee5944da.md b/curriculum/challenges/english/25-front-end-development/review-javascript-maps-and-sets/6723d027b02e4cc6ee5944da.md new file mode 100644 index 00000000000..11bd2abef3c --- /dev/null +++ b/curriculum/challenges/english/25-front-end-development/review-javascript-maps-and-sets/6723d027b02e4cc6ee5944da.md @@ -0,0 +1,73 @@ +--- +id: 6723d027b02e4cc6ee5944da +title: JavaScript Maps and Sets Review +challengeType: 24 +dashedName: review-javascript-maps-and-sets +--- + +# --description-- + +Review the concepts below to prepare for the upcoming quiz. + +## Sets in JavaScript + +- A `Set` is a built-in option for managing data collection. +- Sets ensure that each value in it appears only once, making it useful for eliminating duplicates from an array or handling collections of distinct values. +- You can create a `Set` using the `Set()` constructor: + +```js +const set = new Set([1, 2, 3, 4, 5]); +console.log(set); // Set { 1, 2, 3, 4, 5 } +``` + +- Sets can be manipulated using these methods: + + - `add()`: Adds a new element to the `Set`. + - `delete()`: Removes an element from the `Set`. + - `has()`: Checks if an element exists in the `Set`. + - `clear()`: Removes all elements from the `Set`. + +## Weaksets in JavaScript + +- `WeakSet` is a collection of objects that allows you to store weakly held objects. + +## Sets vs WeakSets + +- Unlike Sets, a `WeakSet` does not support primitives like numbers or strings. +- A `WeakSet` only stores objects, and the references to those objects are "weak," meaning that if the object is not being used anywhere else in your code, it is removed automatically to free up memory. + +## Maps in JavaScript + +- A `Map` is a built-in object that holds key-value pairs just like an object. +- Maps differ from the standard JavaScript objects with their ability to allow keys of any type, including objects, and functions. +- A `Map` provides better performance over the standard object when it comes to frequent addition and removals of key-value pairs. +- You can create a `Map` using the `Map()` constructor: + +```js +const map = new Map([ + ['flower', 'rose'], + ['fruit', 'apple'], + ['vegetable', 'carrot'] +]); +console.log(map); // Map(3) { 'flower' => 'rose', 'fruit' => 'apple', 'vegetable' => 'carrot' } +``` + +- Maps can be manipulated using these methods: + + - `set()`: Adds a new key-value pair to the `Map`. + - `get()`: Retrieves the value of a key from the `Map`. + - `delete()`: Removes a key-value pair from the `Map`. + - `has()`: Checks if a key exists in the `Map`. + - `clear()`: Removes all key-value pairs from the `Map`. + +## WeakMaps in JavaScript + +- A `WeakMap` is a collection of key-value pairs just like `Map`, but with weak references to the keys. The keys must be an object and the values can be anything you like. + +## Maps vs WeakMaps + +- WeakMaps are similar to WeakSets in that they only store objects and the references to those objects are "weak." + +# --assignment-- + +Review the JavaScript Maps, Sets, and JSON topics and concepts. diff --git a/curriculum/challenges/english/25-front-end-development/review-javascript-maps-sets-and-json/6723d027b02e4cc6ee5944da.md b/curriculum/challenges/english/25-front-end-development/review-javascript-maps-sets-and-json/6723d027b02e4cc6ee5944da.md deleted file mode 100644 index 24d5e22f0be..00000000000 --- a/curriculum/challenges/english/25-front-end-development/review-javascript-maps-sets-and-json/6723d027b02e4cc6ee5944da.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -id: 6723d027b02e4cc6ee5944da -title: JavaScript Maps, Sets, and JSON Review -challengeType: 24 -dashedName: review-javascript-maps-sets-and-json ---- - -# --description-- - -Review the concepts below to prepare for the upcoming quiz. - - - -# --assignment-- - -Review the JavaScript Maps, Sets, and JSON topics and concepts. diff --git a/curriculum/superblock-structure/full-stack.json b/curriculum/superblock-structure/full-stack.json index dc145443fc0..b4466356760 100644 --- a/curriculum/superblock-structure/full-stack.json +++ b/curriculum/superblock-structure/full-stack.json @@ -464,11 +464,11 @@ ] }, { - "dashedName": "maps-sets-and-json", + "dashedName": "maps-and-sets", "blocks": [ { "dashedName": "lecture-working-with-maps-and-sets" }, - { "dashedName": "review-javascript-maps-sets-and-json" }, - { "dashedName": "quiz-javascript-maps-sets-and-json" } + { "dashedName": "review-javascript-maps-and-sets" }, + { "dashedName": "quiz-javascript-maps-and-sets" } ] }, {