After N Months...

Published by Mubashir Hassan in

Create a function that takes in year and months as input, then return what year it would be after n-months have elapsed.

Examples

afterNMonths(2020, 24) ➞ 2022

afterNMonths(1832, 2) ➞ 1832

afterNMonths(1444, 60) ➞ 1449

Notes

Assume that adding 12 months will always increment the year by 1.

Watch a quick demo on how Edabit works.