mirror of
https://github.com/tenrok/bootstrap.git
synced 2026-05-15 11:59:39 +03: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user