js 以某個數值為單位 floor - NaClYen/blog GitHub Wiki

今天寫功能第一次碰到這需求, 結果比想像中簡潔, 紀錄一下XD

const unit = 200;
let a = 12345;
let b = a - a % unit;

// b: 12200;