mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-23 18:40:03 +00:00
Replace double tilde with Math.floor
(#30691)
Nowadays, browser engines have improved a lot and `Math.floor` is the same, if not faster. Also, clarity is better than micro-optimizations in this case.
This commit is contained in:
parent
ddf39a5092
commit
7966167cf6
@ -26,7 +26,7 @@ const toType = obj => {
|
||||
|
||||
const getUID = prefix => {
|
||||
do {
|
||||
prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here
|
||||
prefix += Math.floor(Math.random() * MAX_UID)
|
||||
} while (document.getElementById(prefix))
|
||||
|
||||
return prefix
|
||||
|
Loading…
x
Reference in New Issue
Block a user