how to define a global function in javascript code example Example: javascript global function window.my_function = function(){ // }