I want to determine whether my js code is running on the node server or on the client, and store it into a variable isServer = true if it is running on the serv
isServer = true
You could use this:
function is_server() { return ! (typeof window != 'undefined' && window.document); }
As the global window.document object is only present in the browser context.
window.document