Skip to content
This repository has been archived by the owner on Oct 3, 2022. It is now read-only.

add makeId.js #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
- Reysekha
- igrzhukovich
- CinnamonXI
- AkasakaID
- AkasakaID
- JastinXyz
11 changes: 11 additions & 0 deletions src/Javascript/makeId.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const string = "ABCDEFGHIJKLMNOPQRSTUVFXYZabcdefghijklmnopqrstuvwxyz1234567890"
function makeId(number = 8) {
let result = "";
const charlength = string.length;
for(let i = 0; i < number; i++) {
result += string.charAt(Math.floor(Math.random() * charlength));
}
return result;
}

console.log(makeId(10))