Missed a ; after declaring b. The following code is equivalent to what you have.
var b = function() {
console.log ('outer world');
}(function() {})();
Without the ; b becomes self-executing and takes an empty function as a parameter. After that it self-executes again; however, because b does not return a function, you get an exception.
I suggest not to skip ; until you become js ninja :). Keep b inside to avoid global scope pollution.
(function () {
"use strict";
var b = function () {
console.log("hi");
};
// other code
}());
Semicolon auto-insertion discussion
In case you do not want semicolons, add an operator before self-running function
var b = function () { console.log('outer world') }
;(function() { /* ... */ }())
ES6 Update:
(() => {
letconst b = () => console.log('hi')
// ...
})()