UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDentifier), according to RFC 4122, are identifiers designed to provide certain uniqueness guarantees.
While it is possible to implement RFC-compliant UUIDs in a few lines of JavaScript code (e.g., see @broofa’s answer, below) there are several common pitfalls:
- Invalid id format (UUIDs must be of the form “
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
“, where x is one of [0-9, a-f] M is one of [1-5], and N is [8, 9, a, or b] - Use of a low-quality source of randomness (such as
Math.random
)
Thus, developers writing code for production environments are encouraged to use a rigorous, well-maintained implementation such as the uuid module.
Related Posts:
- How to test valid UUID/GUID?
- Uncaught ReferenceError: $ is not defined?
- jQuery document.createElement equivalent?
- How do I run code I have written in JavaScript?
- Error: Can’t set headers after they are sent to the client
- SyntaxError: Unexpected token o in JSON at position 1
- Syntax for an async arrow function
- What is a good regular expression to match a URL? [duplicate]
- TypeError: Router.use() requires middleware function but got a Object
- What does jQuery.fn mean?
- “Uncaught TypeError: Cannot read property ‘style’ of null at.. “
- Difference between document.referrer and window.parent.location.href
- JavaScript replace/regex
- How can I determine if a variable is ‘undefined’ or ‘null’?
- Cannot find module ‘@angular-devkit/core’
- iFrame onload JavaScript event
- What is the difference between state and props in React?
- Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters
- OnChange event using React JS for drop down
- how to get the last character of a string?
- Set timeout for ajax (jQuery)
- Is there an arraylist in Javascript?
- How to convert JSON object to JavaScript array?
- How can I display a JavaScript object?
- JSLint says “missing radix parameter”
- How to handle ETIMEDOUT error?
- bootstrap-datetimepicker for bootstrap 4
- Proper way to wait for one function to finish before continuing?
- How to print HTML content on click of a button, but not the page?
- explode string in jquery
- How do I create and read a value from cookie?
- Check if a variable is of function type
- Bootstrap 4 Dropdown Menu not working?
- document.getElementsByClassName().innerHTML always returns “undefined”
- Bower: ENOGIT Git is not installed or not in the PATH
- How to uncheck a radio button?
- How can I extract a number from a string in JavaScript?
- Angularjs: Error: [ng:areq] Argument ‘HomeController’ is not a function, got undefined
- Truncate a string straight JavaScript
- Phone mask with jQuery and Masked Input Plugin
- JQuery get all elements by class name
- SyntaxError: expected expression, got ‘<'
- Attaching ‘onclick’ event to D3 chart background
- declaration or statement expected javascript/typescript
- Is there a way to get element by XPath using JavaScript in Selenium WebDriver?
- Get class list for element with jQuery
- Object Dump JavaScript
- Convert array to JSON
- Is there a way to read standard input with JavaScript?
- How to disable scrolling temporarily?
- JSON.stringify (Javascript) and json.dumps (Python) not equivalent on a list?
- HTML/Javascript change div content
- How do you remove all the options of a select box and then add one option and select it with jQuery?
- How can JavaScript save to a local file?
- Generating PDF files with JavaScript
- How to disable auto-start of “Node.js: Server-side JavaScript” when using Adobe Dreamweaver?
- How to disable button in React.js
- What’s the effect of adding ‘return false’ to a click event listener?
- New line in JavaScript alert box
- How do I download a file with Angular2 or greater
- What are alternatives to document.write?
- Glidejs with WordPress
- REST API: Backbone and custom endpoint
- Include jQuery UI as a whole
- How to echo JS right after enqueued script to put it into noConflict mode?
- Hooking a callback into the code within a Gutenberg block
- Linking to Files in Root Directory Outside of WP Installation
- How to add JavaScript code on WordPress properly?
- Disable unneeded scripts in a wordpress installation
- How to report JavaScript errors in the admin panel
- Using wp_editor in TinyMCE WindowManager dialog
- Gutenberg add extra attributes to custom format
- Base64 & JSON Encode array in PHP, use as HTML data attribute, decode and parse in JavaScript …. with proper Escaping
- Adding and removing hidden buttons from WordPress Customizer Tinymce widget editor using javascript API
- Change/Replace keyboard character on keypress while writing new post
- Scripts not loading through function Method in WordPress Theme
- wp_enqueue_scripts not enqueing correctly
- Custom Gutenberg block: access dom element via JavaScript
- Add crossorigin to SCRIPT tag
- Sliding pages + wordpress [closed]
- JS / jQuery in Elementor pages vs JS file
- Script widget works only in admin view but not in Public
- JS inside modal doesn’t work
- How to Get Post Meta in .Js File [duplicate]
- Open href in a new window with onclick
- Google Tag Manager only load when connected to Admin
- Darkmode Custom CSS Toggler – Uncaught TypeError
- How to handle wordpress sso authentication with gatsby js?
- Error on clicking ‘Screen Options’ tab only at Products-related editor screen(s) and for specific user
- Development desktop/responsive
- How can javascript be added to a custom-page.php template?
- I would like to retrive JSON value and display it in wordpress page or widget
- How do I call for two js files into a custom template?
- How to delay display of page elements until enqueued script has injected html
- Javascript file doesn’t load
- Receive “menu-toogle” event from section menu in customizer
- Disable PAGESPEED SCRIPT INJECTION to IMAGE in theme files [closed]
- Why the images on mi javascript are not found?
- Browser is showing Javascript code instead of processing it [closed]
- Filtering Gutenberg Components, not Blocks