반응형 아스키코드1 TIL 1011 복리계산 거듭제곱 아스키코드 repeat() 빈 배열, 객체의 타입 객체의 메서드 정의 배열에서 가장 긴 문자열 연이율을 알 때 복리계산 내코드 function interest(interestRate) { /* 원금*이자율/100 > 2 될 때 까지 year를 카운트 */ let year=1; while(true){ if((1+(interestRate/100))**year >= 2){ return year; } year++; } } 복리로 증가하는 원금 일반식 ( 원금 + (연이율 / 100) )^year(연수) 원금을 1로 두고 원금이 2배 이상되는 시점까지 걸리는 연수를 카운트했다. 참고 : www.mathsisfun.com/money/compound-interest.html 다른방법 function computeWhenDouble(interestRate) { let rate = 1 + interestRate .. 2020. 10. 12. 이전 1 다음 반응형