DEV Community

Kitanga Nday
Kitanga Nday

Posted on

4

Easily create UUIDs without a package

So you want to create UUIDs but you don't want to download node-uuid or some other UUID generating library. Then I think you'll like the Web Crypto API.

See, this API comes with a method called randomUUID which generates a random and valid version 4 UUID.

Example:

const uuid = window.crypto.randomUUID(); // returns '5ac3544a-2c5e-4428-b948-41762b123e11'
Enter fullscreen mode Exit fullscreen mode

Hopefully, this comes in handy for you. And before you ask, browser support is amazing!

Image description

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay