|
274 | 274 | ],
|
275 | 275 | "tags": ["string", "tabs", "spaces"],
|
276 | 276 | "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" |
277 | 290 | }
|
278 | 291 | ]
|
279 | 292 | },
|
|
809 | 822 | ],
|
810 | 823 | "tags": ["javascript", "sleep", "delay", "utility", "promises"],
|
811 | 824 | "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" |
825 | 825 | }
|
826 | 826 | ]
|
827 | 827 | },
|
|
0 commit comments