The UUID identifier has been used in programming since the days a baby-faced David Walsh became a professional software engineer. My first exposure to UUIDs was via a ColdFusion app I inherited and … the less we say about that the better. In any event, I was recently surprised to see that JavaScript has the ability to create UUIDs.
Developers can use the native JavaScript crypto
library to generate a UUID:
crypto.randomUUID() // '5872aded-d613-410e-841f-a681a6aa8d8b' crypto.randomUUID() // 'fe6c7438-a833-4c7c-9ea3-cdc84ef41dfc' crypto.randomUUID() // 'e47a03d4-5da3-4451-a2c1-265de99cc2c1' crypto.randomUUID() // '04cdadeb-0228-43db-85dc-ce7e960a6cde'
It’s important to remember that the UUID is not guaranteed to be unique, though the probability of repetition is incredibly low. I look forward to exploring the window.crypto
API further to see what other cool things we can do!
Tips for Starting with Bitcoin and Cryptocurrencies
One of the most rewarding experiences of my life, both financially and logically, has been buying and managing cryptocurrencies like Bitcoin, Litecoin, Ethereum. Like learning any other new tech, I made rookie mistakes along the way, but learned some best practices along the way. Check out…
Being a Dev Dad
I get asked loads of questions every day but I’m always surprised that they’re rarely questions about code or even tech — many of the questions I get are more about non-dev stuff like what my office is like, what software I use, and oftentimes…
background-size Matters
It’s something that makes all men live in fear, and are often uncertain of. It’s never spoken, but the curiosity is always there. Nine out of ten women agree in the affirmative. Advertisers do their best to make us feel inadequate but…
[ad_2]
Source link