Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:11:38+00:00 2026-06-17T19:11:38+00:00

On MDN’s page for setTimer , there is a little shim / compatibility layer

  • 0

On MDN’s page for setTimer, there is a little shim / compatibility layer for setTimer that will let Internet Explorer accept additional arguments in the setTimer method that will be passed to the callback.

I pretty much understand all of the code below:

if (document.all && !window.setTimeout.isPolyfill) {
  var __nativeST__ = window.setTimeout;
  window.setTimeout = function (
                          vCallback, 
                          nDelay /*, 
                          argumentToPass1, 
                          argumentToPass2, etc. */
                          ) {
    var aArgs = Array.prototype.slice.call(arguments, 2);
    return __nativeST__(vCallback instanceof Function ? function () {
      vCallback.apply(null, aArgs);
    } : vCallback, nDelay);
  };
  window.setTimeout.isPolyfill = true;
}

Except for one line:

var aArgs = Array.prototype.slice.call(arguments, 2);

It references arguments, but I cannot see that name being referenced anywhere before this line. It is not on the Reserved words list either, so it does not seem to be magic in any way. In order for me to make any sense out of it, it must somehow refer to the arguments of the overridden setTimeout function, and then use slice() to get every argument after the first two.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:11:39+00:00Added an answer on June 17, 2026 at 7:11 pm

    The object arguments holds all the arguments that were passed to a function including those, that were not named in the function declaration.

    Remember, that assuming the following function

    function doStuf( param1 ) { /* do something */ }
    

    it is also valid to make such a call

    doStuff( 'stuff', 'morestuff', 2, 'evenmorestuff' );
    

    In that case you could reference all parameters using the arguments object.


    So in your particular code, the following row

    var aArgs = Array.prototype.slice.call(arguments, 2);
    

    copies all arguments passed to the shim-function, but the first two. The first two, however, were explicitly named and are referenced as such (vCallback and nDelay).

    • MDN documentation
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

MDN - Stacking without z-index states that when no element in a page has
According to the MDN wiki, DOMContentLoaded will fire when page's DOM is ready, [although]
MDN says : Any SVG elements within a foreignObject will not be drawn, except
On this JS MDN page it says this: JavaScript 1.8.1 note Starting in JavaScript
MDN says that valueOf and getTime are functionally equivalent. Why have two functions that
MDN says: To perform a sticky search, that matches starting at the current position
I just read on MDN that one of the quirks of JS's handling of
According to this MDN page , the delete keyword Returns false only if the
According to the String.prototype.replace() page on MDN , I should be able to easily
MDN claims that: The comma operator evaluates both of its operands (from left to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.