How to remove dashes in UUID with nodejs? [duplicate]
I'm trying to remove the dashes in the UUID by using the replace function on NodeJS but unsuccessful as it always returns with dashes.
const { v4: uuidv4 } = require('uuid');
const uuid = uuidv4().toString()
console.log(uuid.replace("-",""))
The code above is what I'm trying to do to remove the dashes. Thanks
Solution 1:
function replace only try 1 times
you can replace all '-' use RegExp like this:
uuid.replace(/-/gi, '');