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

  • SEARCH
  • Home
  • 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 8061513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:21:44+00:00 2026-06-05T10:21:44+00:00

I am trying to learn Mootools by reading the source and I don’t understand

  • 0

I am trying to learn Mootools by reading the source and I don’t understand why it makes a local copy of Function:

var Function = this.Function;

but why it doesn’t make a local copy of Array, Number and String to do the same, for example they first appear being directly assigned to, so why treat Function differently?

Function.from = function(item){
    return (typeOf(item) == 'function') ? item : function(){
        return item;
    };
};

Array.from = function(item){
    if (item == null) return [];
    return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item];
};

Number.from = function(item){
    var number = parseFloat(item);
    return isFinite(number) ? number : null;
};

String.from = function(item){
    return item + '';
};

Also I don’t understand how on line 149 Function calls the implement function which is stored on its local prototype property?

Function.implement({

hide: function(){
    this.$hidden = true;
    return this;
},

protect: function(){
    this.$protected = true;
    return this;
}

});

is it because Function is a function so its internal [[prototype]] is Function.prototype ?

  • 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-05T10:21:46+00:00Added an answer on June 5, 2026 at 10:21 am
    • You’ll notice that Function is referenced more than the other constructors, so it could be that they added the local reference for a tiny performance boost, as well as for compression since the local variable can be obfuscated. …(Taking another look, I do see more references to the other constructors than I originally had.)

    • You’ll also notice that the .overloadSetter() chained onto the Function.prototype.extend function wraps that function with a bunch of extra code, duck typing and such. So the reason they didn’t use it was probably that this extra code was apparently unwanted/unneeded for their internal use.

    • Because implement extends the prototype, it isn’t always desirable. Sometimes you just don’t want extra methods available on all instances, but you do want to store them in a logical namespace, much like the native methods stored on the Object constructor.

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

Sidebar

Related Questions

trying to learn and practice arrays but I have a problem with this small
Trying to learn a bit about PDO and is going through this tutorial .
Trying to learn F# but got confused when trying to distinguish between fold and
Trying to learn Django, I closed the shell and am getting this problem now
I am trying to learn OpenGL on the iPhone using the Super Bible but
I'm trying to learn Java but it just seem like there are too many
I'm trying learn Python (3 to be more specific) and I'm getting this error:
Trying to learn pointer math better I wrote this code. The intention was to
Trying to learn pointers better I wrote this code. The intention was to print
I am somewhat new to jQuery but have been having fun trying learn about

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.