JavaScript Crash After Removing Any Trivial Statement
I'm working on a short JavaScript program, which works perfectly fine ONLY if I inject any trivial statement--such as var asd;--at a specific location. The program is intended to d
Solution 1:
When you do
MyApp.util.toXML = function(options, obj) {
}
(function(){
}());
you are actually invoking the function
MyApp.util.toXML = function(options, obj) {
}( function(){}()) );
Solution 2:
You are forgetting the ;
after the function definition
MyApp.util.toXML = function() {
// code
}; // this semicolon
Solution 3:
You forgot a semicolon, that's all. See http://jsfiddle.net/bZUm6/6/ (working).
After a function assignment, never forget the ;
!
Solution 4:
You're missing a semicolon after the function. I suppose it evaluates to something else if you don't end the statement.
Post a Comment for "JavaScript Crash After Removing Any Trivial Statement"