Reputation: 13
My boss has asked me to follow this guide for generating a UUID from this link: https://intercom.help/revcontent2/en/articles/3436818-html-ads-generate-your-own-uuids
But I have no clue how to do it. I tried adding it to a file called test.js and opening it on Windows. I tried installing node.js and opening it through command prompt. I pasted it into a fiddle. But no success.
I just need a UUID generated from this code:
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-";
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
return uuid;
}
Can someone please help me? Or just generate a code tell me what it is?
Thank you :)
Upvotes: 1
Views: 7522
Reputation: 2555
First of all, please have a look and search for other threads before creating a new question. Like this one.
This MDN article is also a very good start.
Secondly, for things like this (executing a specific JS code), you can:
Tools -> Developer Menu
(or use specific Windows/Unix shortcuts to get here)Console
uuid()
Sample uuids generated by your code:
Upvotes: 3