DaySmart Software Interview Question

Can you complete the JavaScript function and then write unit testing for it.