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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:59:22+00:00 2026-05-25T23:59:22+00:00

At first I thought it was just assigning obj[0], obj[1], obj[2], etc. to the

  • 0

At first I thought it was just assigning obj[0], obj[1], obj[2], etc. to the jQuery object before returning it, and that the length is manually assigned. But no, since console.log logs an array and not an object.

I took a quick look at the jQuery source but since I’m not familiar with it I didn’t crack it easily. jQuery.makeArray popped first, but it turned out to be the opposite of what I’m looking for, you actually lose the object methods by using it.

My first guess is initiating the array first, and then copying all the properties and methods from the object to it.

Does anybody with the jQuery source code experience have a clear answer to this?

  • 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-25T23:59:22+00:00Added an answer on May 25, 2026 at 11:59 pm

    It’s as simple as creating a new function and assigning it a new array as its prototype.

    function ArrayLike() {}
    ArrayLike.prototype = [];
    

    So for example:

    function ArrayLike() {}
    ArrayLike.prototype = [];
    ArrayLike.prototype.fromArray = function(arr) {
        for(var i = 0; i < arr.length; i++)
            this.push(arr[i]);
    };
    ArrayLike.prototype.foo = function() {
        console.log("foo", this);
    };
    
    var a = new ArrayLike();
    a.fromArray([1, 2]);
    console.log(a);
    a.foo();
    

    http://jsfiddle.net/Xeon06/fUgaf/

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

Sidebar

Related Questions

I very rarely meet any other programmers! My thought when I first saw the
And I'm not meaning Bits Per Minute, but Business Process Management. At first though
First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.
First of all, I know how to build a Java application. But I have
First let me say that I really feel directionless on this question. I am
Greetings, this is my very first question and I just do programming as a
I've found several jQuery syntaxes for nullifying the enter on a form. First one:
I am using Apache FileUpload and I am getting a java.lang.NoClassDefFoundError My first thought
I'm trying to build my first jQuery plug-in yet it's proving to be more
We receive fixed length datasets from a client that look something like this: 1

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.