logo
down
shadow

JavaScript - Inflation/Escalation with Total over X years


JavaScript - Inflation/Escalation with Total over X years

By : Jitendra Singh
Date : October 22 2020, 08:10 AM
this one helps. You need to calculate one more year. In this example you need year 8. Then you can take the percentage of the year and add it to the sum.
In your loop you can use Math.ceil(year). This will round the year up, so with years of 7.373 you will get 8 loops. You can test for this last year and adjust the percentage accordingly:
code :
let year = 7.373;
let money = 24000;
let num = 0;
let total = 0
let percent = 1 + (3.5 / 100);
for (let y = 1; y <= Math.ceil(year); y++) {
  num = num + 1;
  money = money * percent
  if (y > year) { // year 8
    // the sum will only increas .373 of year 8
    money *= 1 - (y - year)
    console.log(`Calculating ${1- (y-year)} of year ${y}`)
  }

  //  increment total
  total += money

  console.log('Year ' + num + ' - ' + money.toLocaleString('en-GB', {
    style: 'currency',
    currency: 'GBP'
  }));
  // other stuff
}
console.log(`Total: after ${year} years:`, total.toLocaleString('en-GB', {
  style: 'currency',
  currency: 'GBP'
}))


Share : facebook icon twitter icon
I want fill five years in a drop-down using javascript and the years will be after the current years

I want fill five years in a drop-down using javascript and the years will be after the current years


By : user3161236
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I want fill five years in a drop-down using javascript and the years will be after the current year. , HTML
code :
<form id="someform">
<select id="year"></select>
</form>
var myselect = document.getElementById("year"), year = new Date().getFullYear();
var gen = function(max){do{myselect.add(new Option(year++,max--),null);}while(max>0);}(5);
var myselect = document.getElementById("year"),
    startYear = new Date().getFullYear()
    count = 5;

(function(select, val, count) {
  do {
    select.add(new Option(val++, count--), null);
  } while (count);
})(myselect, startYear, count);
javascript timestamp from years ago and consider leap years

javascript timestamp from years ago and consider leap years


By : Sumedha Rani
Date : March 29 2020, 07:55 AM
wish of those help The date you create in the second sample corresponds to 1/1 the given year (since you only supply year, day and month default to 0). This is probably not what you want.
If you want people who is a certain age today, you should create a date which corresponds to today and then substract the years, e.g.:
code :
var lowDate = new Date;
lowDate.setFullYear(lowDate.getFullYear() - age));
lowTimestamp = lowDate.getTime()
var highDate = new Date;
highDate .setFullYear(highDate .getFullYear() - age + 1));
highTimestamp = highDate.getTime()
Javascript function to convert decimal years value into years, months and days

Javascript function to convert decimal years value into years, months and days


By : Dennis
Date : March 29 2020, 07:55 AM
Hope this helps I need a function to transform decimal values of years in years, months and days. Ex: 1.5 years = 1 year, 6 month. 2.2527397260273973 years = 2 years, 3 months and 1 day. , I think the best way would be to change all to days, for example:
code :
function yearsToYearsMonthsDays(value)
{
    var totalDays = value * 365;
    var years = Math.floor(totalDays/365);
    var months = Math.floor((totalDays-(years *365))/30);
    var days = Math.floor(totalDays - (years*365) - (months * 30));
    var result = years + " years, " + months + " months, " + days + " days";
    Logger.log(result);
}
How to calculate inflation (CPI) adjusted values over different years in Excel in one formula which is pull-down able?

How to calculate inflation (CPI) adjusted values over different years in Excel in one formula which is pull-down able?


By : ahmed nasser
Date : March 29 2020, 07:55 AM
it helps some times I would like adjust earnings over a couple years for inflation. , Your values are off by a bit. On my computer:
code :
=2.25+(2.25/100*2.49)  --> 2.306025
D2:  =B2*FVSCHEDULE(1,C2:$C$18/100)
how to plot three varaibles(like gdp,inflation,unemployment) for 10 years data in R

how to plot three varaibles(like gdp,inflation,unemployment) for 10 years data in R


By : user908095
Date : March 29 2020, 07:55 AM
To fix the issue you can do my data : , I do something like this
code :
library(data.table)

setDT(dt)

dataGraf <- rbind(data[ ,.(Year, value = Unemployment_Rate, Type = "Unemployment_Rate")],
                  data[ ,.(Year, value = Inflation_Rate, Type = "Inflation_Rate")],
                  data[ ,.(Year, value = GDP, Type = "GDP")])

ggplot(dataGraf,aes(Year, value, color = Type))+geom_line()+geom_point()
Related Posts Related Posts :
  • Chrome-Extension/JavaScript How to make all links on page have no effect?
  • Websocket issue Internet Explorer
  • sessionStorage value becomes null in other tab in AngularJS
  • Split URL from position x to the end in Javascript
  • How to set value of input field with NgIf in Angular 4
  • invalidStateError for second time screenshare on Chrome
  • How do you pass a value to the variable in a xhr.setRequestHeader?
  • I cant start nodemon on my windows 10
  • Nested if else jumps out from the main if else in javascript
  • Iterate through all collections and remove them
  • ES6 - Value of a variable in template string does not increment
  • how to get content of html table cell using javascript javascript depending on checkbox
  • Node.js Working with Multiple Tier SQL
  • Can't allow Cross-Origin Request in local Nodejs server
  • Datatables orderable=false directly on table
  • Dynamically load js content with iron router in meteor using array in return statement
  • Limit checkbox to 2, but moving the select instead of blocking it
  • Why itsn't displaying marker on map?
  • jQuery target next of the same class in the whole DOM
  • encoding must be a valid encoding error in process encoding
  • How to do a date range to view data from selected date highcharts
  • How do I refactor this composed function with Ramda.js?
  • jQuery to serialize selected option's value, not label
  • Convert object to Chartis.js structure
  • Dynamic import with not bundled file
  • Click handler not firing for elements rendered in Ajax Callback - only in Safari
  • Math.max.apply gives an error CreateListFromArrayLike called on non-object
  • get the parent nodes to a given node in d3 dendogram
  • is-dropdown-submenu-parent makes links unclickable on Opera and Chrome
  • JS: Sum column values and updating result on change
  • Query against nested object keys
  • Fullcalendar getting its parent colspan
  • How to retrieve a dynamic number of elements by id
  • How to access redux variables and functions from deep components
  • Efficiently access Array.prorotype.filter single-item returns
  • PHP var into Javascript
  • How to parse json with javascript/jquery if content matches string
  • How can I make a pyramid based on alphabet?
  • Javascript sorting a csv rows and displaying in table
  • How to get specific data from json from api using ajax. The json looks strange to me
  • react js html5 video not working
  • Javascript Angular 4 Change ngClass from another Component
  • Hide multiple table columns with javascript
  • Convert datetime to ISO Format using moment js
  • Dynamically adjust canvas size depending on content
  • setTimeout function with document on click
  • Need advice on nested Promises.all
  • Google Captcha expiration time
  • Syntax of Javascript TAPE unit test
  • Parse php json to javascript
  • Write to Internet Explorer javascript console with vba in excel
  • 2 Forms with Jquery
  • Why the loop stops right in the middle?
  • filter system for restaurant booking
  • how to add active class in framework nav menu when (add/edit) pages are opened
  • Port a js map in dart
  • How to get value from select using javascript
  • Audio won't be muted with JavaScript - removing audio tags with mutationobserver needed
  • How to include an HTML/Javascript game into reactJS website
  • Convert Nodejs server into node module
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org