how to pass parameterless and parameric function into another function in javascript