diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-05-14 09:46:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-14 09:46:42 +0300 |
commit | 7966167cf6d52ce1841b9f1d2d37700ec7d2b3c4 (patch) | |
tree | beef0ea04f20b97a7b66bf127652c8884fd8e0f5 /js | |
parent | ddf39a509213d697857e112d1a7f7a3fc8830d65 (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')
-rw-r--r-- | js/src/util/index.js | 2 |
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 |