javascript functions and musings