# How to generate UUID v4 on weweb?

**URL:** <https://community.weweb.io/t/how-to-generate-uuid-v4-on-weweb/1058>\
**Category:** How do I?\
**Created:** [August 28, 2022, 11:52am UTC](https://community.weweb.io/t/how-to-generate-uuid-v4-on-weweb/1058 "2022-08-28T11:52:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![khairul](https://avatars.discourse-cdn.com/v4/letter/k/a88e4f/32.png) [@khairul](https://community.weweb.io/u/khairul)\
**Post date:** [August 28, 2022, 11:52am UTC](https://community.weweb.io/t/how-to-generate-uuid-v4-on-weweb/1058/1 "2022-08-28T11:52:17Z")

</div>

Hi, is there a way to generate UUID in weweb? Or do I need to use custom javascript, if custom, what’s the function? I need to do this on client side. Thank you

---

<div class="post-metadata">

**Author:** ![stagiaire](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/stagiaire/32/1199_2.png) [@stagiaire](https://community.weweb.io/u/stagiaire)\
**Post date:** [August 29, 2022, 6:49am UTC](https://community.weweb.io/t/how-to-generate-uuid-v4-on-weweb/1058/2 "2022-08-29T06:49:05Z")

</div>

Dunno about weweb, using javascript seems the way to do, here is a function found on stackoverflow :

```auto
function uuidv4() {
  return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
  );
}

console.log(uuidv4());

```

Source :

> <https://stackoverflow.com/questions/105034/how-do-i-create-a-guid-uuid>
