Writing a JavaScript Function: The Usual, The Okay and The Complicated