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.
我想在javascript中找到四舍五入的最接近的数字,例如
10 --> 10
11 --> 10
12 --> 10
13 --> 15
16 --> 15
17 --> 15
18 --> 20
19 --> 20
20 --> 20
var multipleOfFive = Math.round(yourNumber / 5) * 5;