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 7429485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:58:39+00:00 2026-05-29T08:58:39+00:00

The complete code can be found here: http://www.webdeveloper.com/forum/showthread.php?t=224180#6 This emulates jquery like functionality. The

  • 0

The complete code can be found here: http://www.webdeveloper.com/forum/showthread.php?t=224180#6 This emulates jquery like functionality. The next part defines the methods

//define some methods for the utility:
var meths={
    hide:function(a){if(a)a.style.display="none";},
    show:function(a){if(a)a.style.display="";},
    remove:function(a){if(a)a.parentNode.removeChild(a);},
    color:function(a){a.style.color=this||a.style.color;},
    size:function(a){if(a)a.style.fontSize=this||a.style.fontSize;}

};//end meths

I get the above part. This is, of course, a part of a closure. I can’t seem to understand the next part and how calling X.hide() calls the corresponding method in X. If someone would take the time to explain this

//bind the methods to the collection array:
for(var meth in meths)
  (function(n,m){
    output[n]=function(x){output.map(m,x); return output;}
  }(meth, meths[meth]));//next method

return output;
  • 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-05-29T08:58:40+00:00Added an answer on May 29, 2026 at 8:58 am
    // Earlier in the code, 'output' was defined as an array...
    var output = [];
    
    // For each key in the object 'meths'...
    // (which was defined as an object of methods)
    for (var meth in meths)
        // Execute the closure... (using the key as 'n' and the method as 'm')
        (function(n,m){
            // Using the key, assign to the 'output' array a function that
            // maps the current method that we're on, for each element in the array.
            // (Array.map() runs a function, given as the first argument, for each
            // element in an array)
            //
            // In this case, the 'x' in the function is the placeholder for a
            // parameter. Like jQuery, this returns the modified output for chaining.
            output[n] = function(x){ output.map(m,x); return output; };
        })(meth, meths[meth]); // Using the key and method
    
    return output;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very busy write now debugging some code, so I can't cookup a complete
I am trying to do this: List<Parent> test = new List<Child>(); The complete code
I'm using the ajaxify-html5.js script found here: https://github.com/browserstate/ajaxify The script is working great, except
I'm having trouble implmenting the 3rd parameter in the function documented here: http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/reference/async_read_until/overload4.html What
First of all, thanks for all the help thus far. Complete code can be
I'm executing the following code import selenium from selenium import webdriver driver = webdriver.Remote(command_executor="http://selenium.server.com:4444/wd/hub",
I found this while searching for how to fake multiple inheritance in PHP (since
From the documentation I've found this example: We can animate any element, such as
Below is the complete code of the jquery AJAX tab script I am working
I am using the following code --- EDIT @annakata : Adding the complete code

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.