1
var that = this
으로 해결하지 않고 this
을 즉시 호출 함수 식에 전달할 수 있습니까? (경우에 따라 다름)?즉시 호출 함수 표현식에이 함수를 전달
(function(that) {
console.log(that);
})(this)
var that = this
으로 해결하지 않고 this
을 즉시 호출 함수 식에 전달할 수 있습니까? (경우에 따라 다름)?즉시 호출 함수 표현식에이 함수를 전달
(function(that) {
console.log(that);
})(this)
(function(that) {
console.log(that);
})(this);
코드는 작동합니다, 앞에 아무 코드가 세미콜론없이이 없습니다 있는지 확인하십시오.
(function(that) {
console.log(that);
})(this) // if here is no semicolon, the next code will be syntax error.
(function(that) {
console.log(that);
})(this);
세미콜론을 생략하기 전에 아래 코드를 사용해도 괜찮습니다.
!function(that) {
console.log(that);
}(this);
문맥 상 이것은 무엇입니까? 그 함수를 객체 또는 함수 컨텍스트에서 호출하고 있습니까? .. function.apply (context, arguments) 폼이 당신이 찾고있는 것일 수 있습니다 .. –