Asked • 05/08/19

calculate straight line declining?

i have asset (say vehicle) with value of 1000 in this year... var assetCurrentBookValue = 1000 vehicle will depreciate within 5 years... that means the value will become 0 in the next 5 years... var assetLife = 5 yearly depreciation become... var assetYearlyDepreciation = assetCurrentBookValue / assetLife i need to calculate yearly value after yearly depreciation like so... year assetYearlyDepreciation   assetBookVaue 2016 200           1000 2017 200           800 2018 200           600 2019 200           400 2020 200           200 2021 200           0 i need to convert into array like so... [  [2016,1000],  [2017,800],  [2018,600],  [2019,400],  [2020,200],  [2021,0] ] here my workaround... var index = Array.from(Array(assetLife).keys()); var thisYear = new Date().getFullYear() var assetYearlyBookValue = [[thisYear,assetCurrentBookValue]] index.forEach((o) => {  assetYearlyBookValue.push([o + thisYear + 1, assetCurrentBookValue - assetYearlyDepreciation]) }); but ive got.. [  [2016,1000],  [2017,800],  [2018,800],  [2019,800],  [2020,800],  [2021,800] ] any help would be appreciated... thank Youu..

1 Expert Answer

By:

Gabriel F. answered • 10/10/19

Tutor
5.0 (85)

Full Stack Javascript Engineer & Mentor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.