From cdb161068206ca854b59f85a33b3dbd65abccb4d Mon Sep 17 00:00:00 2001 From: Jeevankumar S <110320697+Jeevankumar-s@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:34:08 +0530 Subject: [PATCH] feat(curriculum): add interactive examples to JS Maps and Sets Review (#65313) Co-authored-by: Jeevankumar-S --- .../6723d027b02e4cc6ee5944da.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/curriculum/challenges/english/blocks/review-javascript-maps-and-sets/6723d027b02e4cc6ee5944da.md b/curriculum/challenges/english/blocks/review-javascript-maps-and-sets/6723d027b02e4cc6ee5944da.md index 669bd99f09c..354e47dc475 100644 --- a/curriculum/challenges/english/blocks/review-javascript-maps-and-sets/6723d027b02e4cc6ee5944da.md +++ b/curriculum/challenges/english/blocks/review-javascript-maps-and-sets/6723d027b02e4cc6ee5944da.md @@ -5,7 +5,7 @@ challengeType: 31 dashedName: review-javascript-maps-and-sets --- -# --description-- +# --interactive-- ## Sets in JavaScript @@ -13,11 +13,15 @@ dashedName: review-javascript-maps-and-sets - 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: +:::interactive_editor + ```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`. @@ -43,6 +47,8 @@ console.log(set); // Set { 1, 2, 3, 4, 5 } - 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: +:::interactive_editor + ```js const map = new Map([ ['flower', 'rose'], @@ -52,6 +58,8 @@ const map = new Map([ 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`.