곱연산이 헷갈려서 만들었다.
calc([50, 30, 20]);
function calc(persents){
let value = 1;
let calcPersent = 1;
for(persent of persents){
calcPersent *= (1-(persent/100));
}
value -= calcPersent;
return value*100 + " %";
}
Written with StackEdit.
곱연산이 헷갈려서 만들었다.
calc([50, 30, 20]);
function calc(persents){
let value = 1;
let calcPersent = 1;
for(persent of persents){
calcPersent *= (1-(persent/100));
}
value -= calcPersent;
return value*100 + " %";
}
Written with StackEdit.
댓글남기기