how to create a global function in javascript code example Example: access method globally js window.checkCookie = function(){ // do whatever you want here };