How to get the node ID in jQuery/JavaScript Is there a definitive, universal way to do this? For example using some environment variable that comes with Drupal.behaviours?

I have done some research and there seems to be no common answer.
As mentioned above, Drupal core has no use for the node ID on the client side so it doesn't pass it through. if you want access to it you'll need to add it manually:

function MYMODULE_node_view($node, $view_mode, $langcode) {
  if ($view_mode == 'full') {
    $setting = array('MYMODULE' =&gt; array('currentNid' =&gt; $node-&gt;nid));
    $node-&gt;content['#attached']['js'][] = array(
      'data' =&gt; $setting,
      'type' =&gt; 'setting',
    );
  }
} 


Then on the client side you'll have access to it through Drupal.settings:

var currentNid = Drupal.settings.MYMODULE.currentNid;