This code is equivalent to:
function Ninja() {
// nothing here
}
var ninja = new Ninja();
Though in the code you listed, the function/object Ninja is not global scope.
The code (function() {...})();
basically says “take whatever function is contained inside here and execute it immediately”. So it’s creating an anonymous function and calling it right afterwards.