From 7966167cf6d52ce1841b9f1d2d37700ec7d2b3c4 Mon Sep 17 00:00:00 2001
From: XhmikosR <xhmikosr@gmail.com>
Date: Thu, 14 May 2020 09:46:42 +0300
Subject: [PATCH] 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.
---
 js/src/util/index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/js/src/util/index.js b/js/src/util/index.js
index cee4034811..f92c7eb5d7 100644
--- a/js/src/util/index.js
+++ b/js/src/util/index.js
@@ -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
-- 
GitLab