Update the function incrementCount
to accept two parameters, count
and maximumCount
. The function should increment count
by 1 and add the incremented value to a running total. Only the incremented value should be added to the running total, not the original count
.
This process should continue until the incremented count
(not the running total) reaches or exceeds the maximumCount
. Finally, the function must return the running total. The count should increment at least once irrespective of the maximum count.
Note: Do NOT use do..while
or any other looping constructs. Use higher-order functions like map
, filter
, etc.