feat(curriculum): adding content for form maps and sets review page (#57307)

This commit is contained in:
Zaira
2024-12-02 18:12:22 +05:00
committed by GitHub
parent 38ddd25343
commit 6057f368f4
11 changed files with 110 additions and 52 deletions

View File

@@ -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 <code>Map</code> and <code>Set</code> 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": {

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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"

View File

@@ -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"

View File

@@ -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--

View File

@@ -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.

View File

@@ -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.

View File

@@ -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" }
]
},
{