<script>
window.something = (function(){
return function(x){
console.log(x);
};
})();
something("hello");
</script>
Just wondering, why is the parameter "hello" passed to the function inside the something function which has no parameter? Also, why doesn't the something function execute immediately? Its a self-invoking function but its strange that I have to call it first before it can execute.