Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

How to create a GUID / UUID

function uuidv4() {
  return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  );
}

console.log(uuidv4());
 Run code snippet
Comment

create GUID UUID

function createGuid()  
{  
   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 guid = createGuid(); 
Comment

PREVIOUS NEXT
Code Example
Javascript :: Date object for local time and date 
Javascript :: anchor click event angular refresh page 
Javascript :: selector for redux 
Javascript :: Flatten a multidimension array 
Javascript :: get all child element of class javascript 
Javascript :: react js form radio input using hooks 
Javascript :: react native use route params 
Javascript :: node.js error handling process 
Javascript :: javascript add id to element with class 
Javascript :: component vs container react 
Javascript :: The anchorEl prop provided to the component is invalid. 
Javascript :: context hook 
Javascript :: get all data attributes jquery from multiple elements 
Javascript :: factorial js 
Javascript :: next-dev.js?3515:32 Warning: Prop `className` did not match. Server Client 
Javascript :: javascript check if element has specific child 
Javascript :: firebase.apps.length 
Javascript :: getting te value of select multiple value 
Javascript :: react eslint 
Javascript :: Reusable Alpine.js components 
Javascript :: browser detection 
Javascript :: arrow functions 
Javascript :: class component react 
Javascript :: javascript caeser cipher 
Javascript :: return nothing javascript 
Javascript :: remove duplicates in array 
Javascript :: lodash find all in array 
Javascript :: get role id from role position 
Javascript :: Object.values returns 
Javascript :: how to make button in react js 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =