1var ID = function () {
2 // Math.random should be unique because of its seeding algorithm.
3 // Convert it to base 36 (numbers + letters), and grab the first 9 characters
4 // after the decimal.
5 return '_' + Math.random().toString(36).substr(2, 9);
6};
1$ npm install uuid
2
3const uuidv4 = require("uuid/v4")
4
5uuidv4()
6// expected: 1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed