js 等額本息還款

2021-08-29 09:56:00 字數 1167 閱讀 3011

let money = 10000; // 貸款本金

let periods = 12; // 期數

let yearinterest = 18; // 年率

let month = null; // 月率

let monthinterest = null; // 每月償還本息

let resultarr = ; // 每月償還利息

let resultmoneyarr = ; // 每月償還本金

let monthmoney = ; // 每月剩餘本金

// 月率

month = parseint(yearinterest, 10) / 100 / 12;

// 公式 貸款本金×月利率×(1+月利率)^還款月數〕÷〔(1+月利率)^還款月數 - 1〕

let repaymonthpow = math.pow((1 + month), periods);

monthinterest = ((money * month * repaymonthpow)/(repaymonthpow-1)).tofixed(2);

// 每月償還本息

let _money = money;

for(let i = 0, len = periods; i _money-=(monthinterest - (_money * month));

monthmoney.push(parsefloat(_money.tofixed(2)));

// 每月償還利息

resultarr = monthmoney.map((value) => {

return (value * month).tofixed(2);

// 將第乙個月利息插入

resultarr.unshift((money * month));

resultarr.pop();

// 每月償還本金

resultmoneyarr = resultarr.map((value) => {

return monthinterest - value;

console.log(monthinterest);

console.log(resultmoneyarr);

console.log(resultarr);

console.log(monthmoney);

等額本息還款計算公式

等額本息還款計算公式 設貸款額為a,月利率為i,年利率為i,還款月數為n,每月還款額為b,還款利息總和為y 1 i 12 i 2 y n b a 3 第一月還款利息為 a i 第二月還款利息為 a b a i i a i b 1 i 1 b 第三月還款利息為 a b a i b a i b 1 i ...

貸款那些事之還款方式等額本息(一)

題外話 人在江湖漂,哪有不缺錢的時候。缺小錢,人際關係不錯的情況下,找周圍朋友都能借到。數額大的情況,再找朋友借,一則關係要鐵,二則朋友得有這個錢能借。漂的這幾年也遇到過些奇葩,把同事一圈借個遍,然後跑路的。找各種平台貸款,留著同事 跑路的。一句話,交友需謹慎,遇到借錢更加要謹慎。不以惡意揣度別人,...

等額本息的貸款計算。。後續更新 提前還款

import kotlin.math.pow 剩餘貸款金額 初始化為總貸款數 一百萬 var totalload double 1000000.0 剩餘月供期數 初始化為貸款期限 30 年 var cycle double 360.0 真是貸款期限 var totalcycle int 360 年利...