title: Are all javascript callbacks asynchronous? If not, how do I know which are?
body: <p>I'm curious as to whether all javascript callbacks are asynchronous, or whether that is the case only in certain situations. Also, I'm sure what makes javascript code asynchronous (or ways to use asynchronous javascript) differ between the browser and nodejs, so I'd like to know in each situation what constitutes real asynchronous javascript.</p>
  
  <p>I'm under the impression that in the following scenarion, I'm not actually writing asynchronous code.</p>
  
  <pre><code>function addOne(value){
    value = value + 1;
    return value;
  }
  
  function simpleMap(values, callback){
    for(i = 0; i &lt; values.length; i++){
      val = values[i];
      val = callback(val);
      values[i] = val;
    }
    return values;
  }
  
  newValues = simpleMap([1,2,3], addOne);
  </code></pre>
  
  <p>However, for example, I know that jQuery's AJAX functions are truly asynchronous (not taking in to account the promises which are now available). What is it that make jQuery's AJAX asynchronous? Is it as simple that it involves XHR requests, and in the browser, all XHR requests are asynchronous?</p>
  
  <p>I have the same question for the nodejs environment. Can something in node only be asynchronous if it involves something like file i/o, process.nextTick, setTimeout, or setInterval? Why when I do something like a database call with mongodb/mongoose, is that asynchronous? What's going on behind the scenes that's making it so?</p>
  
  <p>Are asynchronous "situations" predetermined by the environment? Or is there some way to make one's own function truly asynchronous without leveraging very specific functions of the environment (such as xhr, file io in node, process.nexttick, etc)?</p>