题解 | #整数中1出现的次数(从1到n整数中1出现的次数)#
整数中1出现的次数(从1到n整数中1出现的次数)
http://www.nowcoder.com/practice/bd7f978302044eee894445e244c7eee6
function NumberOf1Between1AndN_Solution(n) { // write code here let arr =[]; let point = 0; let ret = 0; while(n-point>0){ arr.push(n-point); point++; } arr.join('').split('').forEach(item=>{ if(item === '1'){ ret++ } }) return ret } module.exports = { NumberOf1Between1AndN_Solution : NumberOf1Between1AndN_Solution };