Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/src/util
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2020-05-14 09:46:42 +0300
committerGitHub <noreply@github.com>2020-05-14 09:46:42 +0300
commit7966167cf6d52ce1841b9f1d2d37700ec7d2b3c4 (patch)
treebeef0ea04f20b97a7b66bf127652c8884fd8e0f5 /js/src/util
parentddf39a509213d697857e112d1a7f7a3fc8830d65 (diff)
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.
Diffstat (limited to 'js/src/util')
-rw-r--r--js/src/util/index.js2
1 files changed, 1 insertions, 1 deletions
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