Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f0c6386

Browse files
Merge pull request #72 from Swaraj-Singh-30/main
Added a Snippet to zip arrays
2 parents 396905e + fa0b90d commit f0c6386

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎public/data/javascript.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@
5555
],
5656
"tags": ["javascript", "array", "shuffle", "utility"],
5757
"author": "loxt-nixo"
58+
},
59+
{
60+
"title": "Zip Arrays",
61+
"description": "Combines two arrays by pairing corresponding elements from each array.",
62+
"code": [
63+
"const zip = (arr1, arr2) => arr1.map((value, index) => [value, arr2[index]]);",
64+
"",
65+
"// Usage:",
66+
"const arr1 = ['a', 'b', 'c'];",
67+
"const arr2 = [1, 2, 3];",
68+
"console.log(zip(arr1, arr2)); // Output: [['a', 1], ['b', 2], ['c', 3]]"
69+
],
70+
"tags": ["javascript", "array", "utility", "map"],
71+
"author": "Swaraj-Singh-30"
5872
}
5973
]
6074
},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /