$ = (function () { console.log("first"); $ = function (){ console.log("second"); } return $ })() /*$() will execute console.log("second") after the first time*/