Created
March 24, 2014 22:55
-
-
Save bennadel/9751103 to your computer and use it in GitHub Desktop.
Calling Sub-Function in Javascript Different in Safari
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will NOT work in safari. | |
function Foo2(){ | |
alert("In Foo2 Method"); | |
( | |
function Bar2(){ | |
alert("In Bar2 Method"); | |
} | |
)(); | |
} | |
// Call the Foo2 method for testing. | |
Foo2(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will work in Safari. | |
function Foo(){ | |
alert("In Foo Method"); | |
( | |
function (){ | |
alert("In Bar Method"); | |
} | |
)(); | |
} | |
Foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will work in Safari. | |
function Foo(){ | |
alert("In Foo Method"); | |
function Bar(){ | |
alert("In Bar Method"); | |
} | |
Bar(); | |
} | |
Foo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment