Create GUID / UUID in JavaScript?
Code
function uuidv4() { return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)); }
Demo
"9dc29dc5-a416-4863-9b67-7b4a2d6bbe0e" "a84538ff-d86b-44d4-8a00-6834c7d95d74" "410292ff-4909-4e57-9e5b-c04117ec6aee" "acd56911-4b12-456e-8ec6-1f52dfc223bf" "beb6d97f-6619-42cc-8f88-42bfac65344d" "1cab4205-ecc9-4bf5-b756-b39b1e3c94e4" "015fe4b2-7c29-448a-8428-09d826bf1ee5" "1e00aad3-8d44-4156-bcf3-e5774092077c" "fc2a85df-b28c-43d5-9926-fb30f6a12aad"
Reference
Create GUID / UUID in JavaScript?