Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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

node uuid

const { v4: uuidv4 } = require("uuid");
import { v4 as uuid } from "uuid";
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 :: local storage in vanila javascript 
Javascript :: node js url download 
Javascript :: dropzone add download button addedfile 
Javascript :: nested function javascript 
Javascript :: reverse sort array of objects 
Javascript :: how to allow implicit any in .d.ts 
Javascript :: 404 page in react 
Javascript :: owl timeout loop 
Javascript :: javascript date get next 15 minutes 
Javascript :: js initialize array with values 
Javascript :: getattribute javascript 
Javascript :: creating react app 
Javascript :: how to check if a date has passed javascript 
Javascript :: how to update node in terminal 
Javascript :: copy string js 
Javascript :: How to make HTML input tag only accept numerical values? in jsx 
Javascript :: js store regex in variable and combine 
Javascript :: some method javascript 
Javascript :: two digits number javascript 
Javascript :: jquery datepicker 
Javascript :: vscode js intellisence not working 
Javascript :: parseint js 
Javascript :: uncheck multiple checkboxes javascript 
Javascript :: javascript fill 2 dimensional array 
Javascript :: how to remove the desimal numbers in javascript 
Javascript :: js change number to string 
Javascript :: how to toggle navbar using javascript 
Javascript :: disabling ctrl + s using javascript 
Javascript :: how to get a due date from current date in javascript 
Javascript :: select the first elemnt have class in jquery 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =