How to write a javascript function that works for both the statements

I have been asked in an interview to write a function that works for both the below mentioned statements.

sum(2,5)
sum(2)(5)