[javascript] How to override a JavaScript function