mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-05-21 13:24:08 +03:00
Merge pull request #18391 from twbs/double-bitwise-not-comment
util.js: Add comment explaining ~~ trick
This commit is contained in:
+1
-1
@@ -99,7 +99,7 @@ const Util = (($) => {
|
||||
|
||||
getUID(prefix) {
|
||||
do {
|
||||
prefix += ~~(Math.random() * 1000000)
|
||||
prefix += ~~(Math.random() * 1000000) // "~~" acts like a faster Math.floor() here
|
||||
} while (document.getElementById(prefix))
|
||||
return prefix
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user