function multipleList(integer, limit) { var result = []; for(var i = integer; i <= limit; i += integer) { result.push(i); } return result; }

// 示例 console.log(multipleList(3, 15)); // [3, 6, 9, 12, 15] console.log(multipleList(4, 20)); // [4, 8, 12, 16, 20] console.log(multipleList(5, 25)); // [5, 10, 15, 20, 25]


原文地址: https://www.cveoy.top/t/topic/mlMT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录