More actions
imported>rabierre No edit summary |
imported>rabierre No edit summary |
||
| Line 4: | Line 4: | ||
function duple_test() { | function duple_test() { | ||
function inner() { | function inner() { | ||
/* body comes here */ | |||
} | } | ||
} // good | } // good | ||
| Line 9: | Line 10: | ||
function duple_test() { | function duple_test() { | ||
function () { | function () { | ||
/* body comes here */ | |||
} // anonymous inner class can't be reached | } // anonymous inner class can't be reached | ||
} // bad | } // bad | ||
| Line 20: | Line 22: | ||
function two() { | function two() { | ||
function three() { | function three() { | ||
/* body comes here */ | |||
} | } | ||
} | } | ||
} // good | } // good | ||
Revision as of 06:47, 18 January 2011
- 함수
- 중첩함수
- 중첩 함수 예
function duple_test() {
function inner() {
/* body comes here */
}
} // good
- 내부 익명함수는 접근할 수 없기 때문에 안됨
function duple_test() {
function () {
/* body comes here */
} // anonymous inner class can't be reached
} // bad
- 이 방법은 된다
function duple_test() {
var one = function () {
} // anonymous but reachable
}
- 여러번 중첩되어도 된다
function one(){
function two() {
function three() {
/* body comes here */
}
}
} // good