What is UUID/GUID?
A universally unique identifier (UUID) is a 128-bit label used for information in computer systems. The term globally unique identifier (GUID) is also used instead of UUID.
For example: “4ab4e2a1-0efb-4e5b-8f73-e503f5b8e89f”
Traditionally, we needed to use either Math.Random(), or the Date object and then convert it into a UUID format. But now all we need is:
crypto.randomUUID() // "819df8d4-587b-4200-90b3-d30f8ed01457"
It is important to note that it still might not generate a unique value though the probability of that happening is fairly low.