Update `how to define a function in javascript`