var status = (function () { var flag = true return { getStatus: function () { console.log('bar') } } })() console.log(status)