i have created a function which is working fine , however, i would like to add if else statement inside function.reduce and im not sure if this is achievable. tried researching