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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:24:49+00:00 2026-06-14T21:24:49+00:00

Recently I am learning to make javascript class, I saw other people make class

  • 0

Recently I am learning to make javascript class, I saw other people make class like this

var item = {
     'a':{'b':1000,'c':2000,'d':3000} , //how to make a variable become an array?
     myfunction : function(){
         console.log(item.a.b); //and output item.a[1]?
     }
 };
 item.myfunction();

But is it possible to make variable a an array? and output a variable item.a[1] like that?I tried

var a=new Array('1000','2000','3000')
but error, I need a correct syntax.

  • 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-14T21:24:51+00:00Added an answer on June 14, 2026 at 9:24 pm
    var item = {
        'a': [1000, 2000, 3000],
        myfunction: function () {
            console.log(this.a[1]);
        }
    };
    

    But that’s not a class, and there is no “variable a”.

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

Sidebar

Related Questions

I have recently started learning Silverlight and can't figure out how make this work.
I recently started learning Objective-C. I decided to make a class called Student with
I've recently started learning C#. I just learned about properties and decided to make
I've recently been learning javascript by writing some gnome shell extensions, and hence my
I've been learning Js recently from JavaScript the Good Parts , and according to
I recently satrted learning OpenGL, and it seems pretty intuitive so far, but this
Recently learning Android, there is a Handler class in android which is very useful.
I've recently started learning Spring Batch in order to make use of some of
I've recently started learning programming to make my own 3D OpenGL game on the
I am still learning javascript and xml and have recently been presented with an

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.