[javascript] setTimeout, setInterval 파라미터 버그

avatar
(Edited)
  • IE 9 이하로 setTimeout 선언시에 파라미터 값을 던지면 값이 undefined 로 넘어온다.

1. 버그 상황

setTimeout( fncName, duration, param1, param2 );

2. 대응 코드

  • 아래와 같이 익명함수로 하나 감싸서 던지거나 새로운 함수를 지정하여 던져서 실행하면 문제가 없다.
setTimeout(function() {
  fncName( param1, param2 );
}, duration);

3. 참고



0
0
0.000
3 comments
avatar

Congratulations @nonoll! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got your First payout

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemitBoard Ranking update - A better rich list comparator
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
0
0
0.000