JSLint “out of scope” error due to function ordering?
问题 JSLint seems to be picky about function ordering. This passes fine: function a() { 'use strict'; return 1; } function b() { 'use strict'; a(); } While this gives an 'a' is out of scope error message: function b() { 'use strict'; a(); } function a() { 'use strict'; return 1; } Is this by design? Should I care? How can it be avoided in larger (more complex) cases, where it might not always be possible to give the functions a clear order? 回答1: JSLint/JSHint expect you to define functions before