Unverified Commit 7966167c authored by XhmikosR's avatar XhmikosR Committed by GitHub
Browse files

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.
parent ddf39a50
Showing with 1 addition and 1 deletion
+1 -1
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment