function percentify(num, param){
for(var i=(param==true?0:1),array=[]; i<=num; i++)
array.push( (param==true?i:1)*100/num )
return array
}
console.log( percentify(7,true)[5] );
答案 0 :(得分:1)
猜测解决方案..解释&#34; 7分成7个部分,每个部分代表100和#34的百分比数量;
class Pawn{
private boolean hasMovedAlready=false;
...
public Pawn copy(){
return new Pawn(hasMovedAlready, ...);
}
输出
function eqPercentify(num){
for(var i=1,result=[]; i<=num; i++){
result.push(i * 100 / num);
}
return result;
}
console.log( eqPercentify(7) );