Returns a new function which when applied to an argument, has the same effect as applying the specified function to the same argument 2 times.
the function to be repeated
the new function that has the same effect as (x => func(func(x)))
(x => func(func(x)))
const plusTwo = twice(x => x + 1);plusTwo(2); // Returns 4 Copy
const plusTwo = twice(x => x + 1);plusTwo(2); // Returns 4
Returns a new function which when applied to an argument, has the same effect as applying the specified function to the same argument 2 times.