Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将一个数字始终放在 6 个数字的同一框架中
所以如果我有一个 7-13 之间的数字,我想把它降到 6。如果我有 14-20 之间的数字,我想把它降到 13、21-27 到 20 等等。我有任何可能这样做floor()
floor()
function weirdFloor(n) { return Math.floor(n / 7) * 7 - 1; }