I'm very new to JS, I want to generate an UUID. Here's what I tried, step by step:
mkdir testcd testtouch file1.js- Inside
file1.js:
let crypto;
try {
crypto = require('crypto');
} catch (err) {
console.log('crypto support is disabled!');
}
var uuid = crypto.randomUUID();
console.log(uuid);
And you see the error. What is wrong? I can't find answer anywhere. Node JS version:
node -v shows v12.22.9
