Why does Twitter redefine window.setTimeout and window.setInterval?
问题 I was studying the Twitter source code, and I came across the following snippet: window.setTimeout=window.setTimeout;window.setInterval=window.setInterval; Why does Twitter redefine these functions? Edit: To see the code, go to any twitter user page, open the source of the page, and you will see that snippet in the second block of javascript. 回答1: This is a technique to replace setTimeout and setInterval functions globally in a cross-browser fashion. window.setTimeout , when used as an lvalue