Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript generate uuid

const generateUuid = (): string => {
    return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (character) => {
        const random = (Math.random() * 16) | 0;
        const value = character === "x" ? random : (random & 0x3) | 0x8;

        return value.toString(16);
    });
};
Comment

uuid 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" 
Comment

uuid javascript

    function uuid() {
        const template = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
        const xAndYOnly = /[xy]/g;

        return template.replace(xAndYOnly, (character) => {
            const randomNo =  Math.floor(Math.random() * 16);
            const newValue = character === 'x' ? randomNo : (randomNo & 0x3) | 0x8;

            return newValue.toString(16);
        });
    }
Comment

uuid in node js

const {v4 : uuidv4} = require('uuid')
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to save input from box html 
Javascript :: material ui datepicker remove error 
Javascript :: yarn dev 
Javascript :: js sort string array 
Javascript :: defer parsing of javascript wordpress 
Javascript :: react native touchableopacity 
Javascript :: nextjs socket 
Javascript :: regex select string between two strings 
Javascript :: get first property from object javascript 
Javascript :: express cors 
Javascript :: js redirect to url 
Javascript :: redirect to page in javascript 
Javascript :: vue test utils emitted 
Javascript :: select first 3 letters js 
Javascript :: display toastr warning 
Javascript :: URL scheme "localhost" is not supported. 
Javascript :: console redux state shows proxy 
Javascript :: javascript interview preparation 
Javascript :: get file name nodejs 
Javascript :: flutter text with icon 
Javascript :: javascript returned function and copy to clipboard 
Javascript :: nth value of the Fibonacci sequence in js 
Javascript :: push element to array to first place js 
Javascript :: javascript new date 30 days ago 
Javascript :: how to get mat input value on keyup javascript 
Javascript :: react native run android 
Javascript :: check fro text input jquery 
Javascript :: validate age javascript 
Javascript :: react typewriter 
Javascript :: load a page with ajax 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =