Question: I want a member function made in typescript that takes in a year from an arraylist (between 2014-2019) adds 3 to it, and then compares

I want a member function made in typescript that takes in a year from an arraylist (between 2014-2019) adds 3 to it, and then compares it to the time left to reach the current year. IE: if I used 2015 it would return -3. 2015+3 = 2018. The current year is 2021. 2018-2021 = -3. If I used 2019 then it would return 1. I dont need an arraylist made I have one. I will provide one for an example to be used.

differenceinyears() {

//code here

}

var yearList = []; var compareyear= { "year": "2015" }; yearList.push(compareyear);

console.log(yearList[i].differenceinyears); //this should output the year difference.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!