Javascript – Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed. How to refactor this code
How to reduce the complexity of the given piece of code? I am getting this error in Sonarqube---> Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed. Here the daysPassed is the time which is…