Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions public/data/javascript.json
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,19 @@
],
"tags": ["javascript", "sleep", "delay", "utility", "promises"],
"author": "0xHouss"
},
{
"title": "Random string",
"description": "Generates a random string of characters of a certain length",
"code": [
"function makeid(length, characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {",
" return Array.from({ length }, () => characters.charAt(Math.floor(Math.random() * characters.length))).join('');",
"}",
"",
"console.log(makeid(5), \"1234\" /* (optional) */);"
],
"tags": ["javascript", "function", "random"],
"author": "kruimol"
}
]
},
Expand Down