Skip to content

Commit 2c1ff11

Browse files
Merge pull request #58 from kruimol/main
Change to the random string generator
2 parents d2c5024 + 35278fb commit 2c1ff11

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

public/data/javascript.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,19 @@
274274
],
275275
"tags": ["string", "tabs", "spaces"],
276276
"author": "axorax"
277+
},
278+
{
279+
"title": "Random string",
280+
"description": "Generates a random string of characters of a certain length",
281+
"code": [
282+
"function makeid(length, characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {",
283+
" return Array.from({ length }, () => characters.charAt(Math.floor(Math.random() * characters.length))).join('');",
284+
"}",
285+
"",
286+
"console.log(makeid(5, \"1234\" /* (optional) */));"
287+
],
288+
"tags": ["javascript", "function", "random"],
289+
"author": "kruimol"
277290
}
278291
]
279292
},
@@ -809,19 +822,6 @@
809822
],
810823
"tags": ["javascript", "sleep", "delay", "utility", "promises"],
811824
"author": "0xHouss"
812-
},
813-
{
814-
"title": "Random string",
815-
"description": "Generates a random string of characters of a certain length",
816-
"code": [
817-
"function makeid(length, characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {",
818-
" return Array.from({ length }, () => characters.charAt(Math.floor(Math.random() * characters.length))).join('');",
819-
"}",
820-
"",
821-
"console.log(makeid(5), \"1234\" /* (optional) */);"
822-
],
823-
"tags": ["javascript", "function", "random"],
824-
"author": "kruimol"
825825
}
826826
]
827827
},

0 commit comments

Comments
 (0)