Answers for "generate unique id javascript"

6

javascript generate unique id

function randomId(): string {
  const uint32 = window.crypto.getRandomValues(new Uint32Array(1))[0];
  return uint32.toString(16);
}
Posted by: Guest on December-29-2020
1

generate unique id javascript

var uniq = 'id' + (new Date()).getTime();
Posted by: Guest on July-31-2021
6

generate unique id javascript

function uuid() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

var userID=uuid();//something like: "ec0c22fa-f909-48da-92cb-db17ecdb91c5"
Posted by: Guest on July-22-2019
3

javascript generate unique id

function uuidv4() {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
    return v.toString(16);
  });
}

console.log(uuidv4());
Posted by: Guest on March-17-2020
0

unique string id js

const uid = () => {
  return Date.now().toString(36) + Math.random().toString(36).substr(2);
};

// Usage. Example, id = khhry2hb7uip12rj2iu
const id = uid();
Posted by: Guest on August-14-2021

Code answers related to "generate unique id javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language