We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 89acc0d commit d2c5024Copy full SHA for d2c5024
public/consolidated/all_snippets.json
@@ -1645,6 +1645,23 @@
1645
"promises"
1646
],
1647
"author": "0xHouss"
1648
+ },
1649
+ {
1650
+ "title": "Random string",
1651
+ "description": "Generates a random string of characters of a certain length",
1652
+ "code": [
1653
+ "function makeid(length, characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {",
1654
+ " return Array.from({ length }, () => characters.charAt(Math.floor(Math.random() * characters.length))).join('');",
1655
+ "}",
1656
+ "",
1657
+ "console.log(makeid(5), \"1234\" /* (optional) */);"
1658
+ ],
1659
+ "tags": [
1660
+ "javascript",
1661
+ "function",
1662
+ "random"
1663
1664
+ "author": "kruimol"
1665
}
1666
]
1667
},
0 commit comments