<script> var func1 = function(){ var func2 = function(){ alert('Hello from func2'); } return func2; } var q = func1(); q(); </script>