In this code I see the second console.log is called before the one inside the anonymous function.
Is this an example of hoisting? Is it something specific to do with jquery?
var test_var = 'original test_var';
$(document).ready(function() {
    $(function() {
      test_var = 'test_var has been altered!';
      console.log("test_var 1");
      console.log(test_var); //displays 'test_var has been altered!'
    });
    console.log("test_var 2");
    console.log(test_var); //displays 'original test_var'
});
