Skip to content

Commit 11255aa

Browse files
committed
Update consolidated snippets
1 parent 4d917df commit 11255aa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

public/consolidated/javascript.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@
2828
"contributors": [],
2929
"code": "const removeDuplicates = (arr) => [...new Set(arr)];\n\n// Usage:\nconst numbers = [1, 2, 2, 3, 4, 4, 5];\nconsole.log(removeDuplicates(numbers)); // Output: [1, 2, 3, 4, 5]\n"
3030
},
31+
{
32+
"title": "Remove Falsy Values",
33+
"description": "Removes falsy values like null, undefined, and false from an array.",
34+
"author": "mubasshir",
35+
"tags": [
36+
"javascript",
37+
"array",
38+
"falsy",
39+
"filter"
40+
],
41+
"contributors": [],
42+
"code": "const removeFalsy = (arr) => arr.filter(Boolean);\n\n// Usage:\nconst array = [0, 1, false, 2, \"\", 3, null];\nconsole.log(removeFalsy(array)); // Output: [1, 2, 3]\n"
43+
},
3144
{
3245
"title": "Shuffle Array",
3346
"description": "Shuffles an Array.",

0 commit comments

Comments
 (0)