日照项目的居民端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 lines
292 B

/**
* 数字转数组
*
* @type signature
* Number a -> Array [1, 2, 3… a]
*/
export default (num, noZero = true) => {
const n = parseInt(num);
if (isNaN(n)) return [];
let arr = [];
for (let i = (noZero ? 1 : 0); i <= n; i++) {
arr.push(i);
}
return arr;
}