Javascript default behavior of load method

Posted in JavaScript, on 8/3/2014

Was curious and although I think I kind of know the result but just want to do a check what's default javascript behavior to load the method.
Should I always put the method to the beginning of the script or end of the script.

Looks like I can't put the end of the script, javascript will return error says, function is not defined.

        var beginningOfInlineJs = function () {

        (function () {
            var myVariable = "my_private_stuff";
            var privateMethod = function () {

            var privateMethod2 = function (msg) {
                return myVariable + msg;

            var init = function(){

            return {
                public1: privateMethod,
                public2: privateMethod2


        var endOfInlineJs = function () {