Read the original article here
UUID is the abbreviation of univerally unique identifier, which is an identification number to uniquely identify something. The main idea of this thing is everytime we generate this numbers, it will be universally unique, which means no one could generate the exact same id as yours.
uuid to generate UUID.
$ npm install uuid
const uuidv4 = require("uuid/v4") uuidv4()
UUID has several versions, but the version that appropriate for generating unique id is version 4. And, that code will generate something like this.
Math.floor(Math.random() * 100)
Math.random always returns a decimal number, so we need to rounding off that number first. By multiply it with 100, it will return any number between 0 to 99. You can increase the number if you want to get better result.