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