We are required to write a JavaScript function that takes in a number (representing the number of days) and returns an object with three properties, namely −
And the properties should have proper values of these four properties that can be made from the number of days. We should not consider leap years here and consider all years to have 365 days.
Number of years = (Number of days ) / 365
Number of years will be the quotient when number of days will be divided by 365 i.e days / 365 = years.
Number of weeks will be the result of (Number_of_days % 365) / 7.
Number of days will be the result of (Number_of_days % 365) % 7.
Learners TV is a website that is designed to educate users and provide instructional material on particular subjects and topics.