[Solved] How; The most difficult question of your life [closed]


It returns 5 on first iteration if you pass 4 to it. In general it returns n + 1 for any n > 1.

Following the code path, it can be unrolled into

product = 1
n > product // true, loop
product *= n // so product is n
product++ // end of loop, product is n+1
n > product // false, exit loop

return product

If n === 1, the first check is false so it returns just 1.

2

solved How; The most difficult question of your life [closed]