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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:30:33+00:00 2026-06-17T17:30:33+00:00

I recently encountered an problem where I am not creating an array correctly for

  • 0

I recently encountered an problem where I am not creating an array correctly for objects.

So I tried to do the following thing in javascript:

function Mesh()
{
    this.buffer = [10, 10, 10];
}

Mesh.prototype.getBuffer = function ()
{
    return this.buffer;
};

function main()
{
    var model = new Mesh();
    var modelBuffer = model.getBuffer;
    document.getElementById("textSection").innerHTML = modelBuffer[0];
}

I’m trying to avoid using global variable hence I’ve created the array the way I did in my Mesh() constructor. But when I try to retrieve the data from slot 0 it prints “undefined”. How do I get this work? I really have no idea why this is happening…

  • 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-17T17:30:35+00:00Added an answer on June 17, 2026 at 5:30 pm

    Try:

    var modelBuffer = model.getBuffer();
    

    Instead of:

    var modelBuffer = model.getBuffer;
    

    You were assigning the function to the variable, instead of calling the function.

    It’s always a good idea to console.log() variables that don’t return what you expect them to. In this case:

    console.log(modelBuffer);
    

    Logged:

    // function ()
    // {
    //     return this.buffer;
    // }
    

    Pointing me into the direction of the modelBuffer assignment, for example.

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

Sidebar

Related Questions

I recently encountered a problem with my Profile provider: it wouldn't retrieve profiles correctly
recently I've encountered a problem with IE. I have a function function() { ShowProgress();
I recently encountered a problem in my website - some users do not have
I recently encountered this problem. I found many instances of people asking the question—
I've recently encountered a problem designing a web page. I needed to have rounded
I've recently begun learning C# but have encountered an annoying problem. Every variable I
I recently encountered with this question: How to reduce this expression: s>73?61:60; . The
i have made a small app using javascript and html. But recently i encountered
Recently, I encountered an unknown problem causing particular folder in NTFS folder to be
I recently tried to merge a series of changeset and encountered a huge number

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.