test code for function calling pattern in js