Generating a UUID (Universally Unique Identifier) with vanilla JS

Today, I wanted to quick show you how to generate a UUID (University Unique Identifier) using the vanilla JS crypto.randomUUID() method.
There’s really not much to show. You run it, and it generates a unique ID.
// returns something like this: // “f116fb21-79f2-4ec0-8a81-85b5837ea0f3” let id = crypto.randomUUID(); Because it’s a cryptographically secure identifier, it requires an SSL certificate to run. However, exceptions are made for localhost:// and file:// for testing.


This content originally appeared on Go Make Things and was authored by Go Make Things

Today, I wanted to quick show you how to generate a UUID (University Unique Identifier) using the vanilla JS crypto.randomUUID() method.

There’s really not much to show. You run it, and it generates a unique ID.

// returns something like this: 
// "f116fb21-79f2-4ec0-8a81-85b5837ea0f3"
let id = crypto.randomUUID();

Because it’s a cryptographically secure identifier, it requires an SSL certificate to run. However, exceptions are made for localhost:// and file:// for testing.

Last Chance! A new session of the Vanilla JS Academy started this week, but it's not too late to join. Sign up today and get 25% off registration.


This content originally appeared on Go Make Things and was authored by Go Make Things


Print Share Comment Cite Upload Translate Updates
APA

Go Make Things | Sciencx (2022-07-18T14:30:00+00:00) Generating a UUID (Universally Unique Identifier) with vanilla JS. Retrieved from https://www.scien.cx/2022/07/18/generating-a-uuid-universally-unique-identifier-with-vanilla-js/

MLA
" » Generating a UUID (Universally Unique Identifier) with vanilla JS." Go Make Things | Sciencx - Monday July 18, 2022, https://www.scien.cx/2022/07/18/generating-a-uuid-universally-unique-identifier-with-vanilla-js/
HARVARD
Go Make Things | Sciencx Monday July 18, 2022 » Generating a UUID (Universally Unique Identifier) with vanilla JS., viewed ,<https://www.scien.cx/2022/07/18/generating-a-uuid-universally-unique-identifier-with-vanilla-js/>
VANCOUVER
Go Make Things | Sciencx - » Generating a UUID (Universally Unique Identifier) with vanilla JS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/07/18/generating-a-uuid-universally-unique-identifier-with-vanilla-js/
CHICAGO
" » Generating a UUID (Universally Unique Identifier) with vanilla JS." Go Make Things | Sciencx - Accessed . https://www.scien.cx/2022/07/18/generating-a-uuid-universally-unique-identifier-with-vanilla-js/
IEEE
" » Generating a UUID (Universally Unique Identifier) with vanilla JS." Go Make Things | Sciencx [Online]. Available: https://www.scien.cx/2022/07/18/generating-a-uuid-universally-unique-identifier-with-vanilla-js/. [Accessed: ]
rf:citation
» Generating a UUID (Universally Unique Identifier) with vanilla JS | Go Make Things | Sciencx | https://www.scien.cx/2022/07/18/generating-a-uuid-universally-unique-identifier-with-vanilla-js/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.