DEV Community

Evan Winter
Evan Winter

Posted on • Updated on


TIL – Generate unique IDs with Crypto.randomUUID()

Today I learned that you can generate UUIDs using the Web Cryptography API.

Here’s what it looks like:

let uuid = self.crypto.randomUUID();
console.log(uuid); // “36b8f84d-df4e-4d49-b662-bcde71a8764f”
Enter fullscreen mode Exit fullscreen mode

MDN docs:

Top comments (0)

Visualizing Promises and Async/Await 🤯

async await

☝️ Check out this all-time classic DEV post