> > I'm not sure whether this is strictly a Firebug question or really a > JavaScript question... > Please note that these warnings come from Firefox. Firebug is just displaying them. So this is a JavaScript/ECMAScript question.
> Two of the warnings say something like "TypeError: function foo does not > always return a value". I don't understand why that's an issue. Is a > function required to always return a value? I never heard that. And why > would that be a "type error" anyway? I associate type errors with something > like trying to pass a non-number to something that needs a number, etc. > I can't the definition right now but the rule is to either have no returninside the function or to always have a return value. So this normally happens when you have a return statement within an if-block but not in the else-block. The third warning says "SyntaxError: in strict mode code, functions may be > declared only at top level or immediately within another function". I never > heard that either. In this case, I have a long, complex function with > various nested functions and other code in logical order. It would be much > less clear (to me, not to the computer) if I declared all the functions up > top. And what does "immediately within another function" mean anyway? > See ES5 Implementation Best Practice<http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls> . > What I also don't understand is that, as I said, these messages only > appear when I turn on "Warnings", *not* when I just turn on "Errors"... > so why do they have the word *Error* in the message, like "TypeError" or > "SyntaxError"? > That's specified by the ECMAScript standard. Strict errors are generally displayed as warnings inside Firebug. The code runs fine on every browser I've tested it on. Are these warnings > -- or errors, or whatever the heck they are -- anything for me to be really > concerned about? > The Mozilla Wiki provides a detailed description<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/Strict_mode>about strict mode code restrictions. Sebastian > -- You received this message because you are subscribed to the Google Groups "Firebug" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/firebug. To view this discussion on the web visit https://groups.google.com/d/msgid/firebug/f6450815-bd03-4e3d-a351-2c74dd6ecbca%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
