Skip to content

Instantly share code, notes, and snippets.

@louicoder
Created December 15, 2022 13:10

Revisions

  1. louicoder revised this gist Dec 15, 2022. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion randomString.js
    Original file line number Diff line number Diff line change
    @@ -1 +1,11 @@
    ‎‎
    export const generateString = (length = 10) => {
    const characters =
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    let result = "";
    // const charactersLength = characters.length;
    for (let i = 0; i < length; i++) {
    result += characters.charAt(Math.floor(Math.random() * characters.length));
    }

    return result;
    };
  2. louicoder created this gist Dec 15, 2022.
    1 change: 1 addition & 0 deletions randomString.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    ‎‎