打印两位数的逢n过游戏,遇到能被n整除或者带n的数字打印“过”代替
代码如下:
function pass (n) {
for (var i = 1; i < 100; i++) {
var gw = i % 10
var sw = parseInt(i / 10)
if (sw === n || gw === n || i % n === 0) {
console.log(‘过‘)
continue
}
console.log(i)
}
}
pass(6)
效果如下:
原文:https://www.cnblogs.com/pearlpearl/p/12657191.html