// This will work in Safari. function Foo(){ alert("In Foo Method"); ( function (){ alert("In Bar Method"); } )(); } Foo();