Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
119
rated 0 times [  120] [ 1]  / answers: 1 / hits: 7348  / 5 Years ago, thu, may 23, 2019, 12:00:00

Try to use lodash (version 4.17.11)



_.uniqueId() always returns 1 instead of random 3-digits number.



Also _.uniqueId('prefix') always returns prefix1.



Is it a problem?


More From » npm

 Answers
4

lodash _.uniqueId() gives you a unique ID thats it. It will never give you the same ID twice while executing your script (if you restart the script it can and will give you the same output) but there is no random number or no specified number of digits. Just try running it.



_.uniqueId() //1
_.uniqueId() //2
_.uniqueId() //3

[#7540] Tuesday, May 21, 2019, 5 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
reed

Total Points: 725
Total Questions: 85
Total Answers: 89

Location: Singapore
Member since Sat, Jul 25, 2020
4 Years ago
;