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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:15:00+00:00 2026-06-01T04:15:00+00:00

I am actually new to both spider monkey api and this mailing list. Actually

  • 0

I am actually new to both spider monkey api and this mailing list. Actually I was trying to create a Array like objectA.arrayA and the call back code goes like this.

    char *value[] = {"abc", "xyz", "efg"};
    int count = 0;
    JSObject* val = JS_NewArrayObject(pContext, 0, NULL);

    while(count < 3) {
        jstr = JS_NewStringCopyZ(pContext, value[count]);

        JS_DefineElement(pContext, val, count++, STRING_TO_JSVAL(jstr),
                        NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
    }

    vJs->DefineProperty(pObject, "arrayA", OBJECT_TO_JSVAL(val));

I am getting the proper value for the objectA.arrayA but when I do objectA.arrayA.length, it says arrayA does not have ay property. Can you tell what i am doing wrong. I am facing the same even when I am creating a sting.

  • 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-01T04:15:01+00:00Added an answer on June 1, 2026 at 4:15 am

    Your first apparent problem is:

    JS_NewArrayObject(pContext, 0, NULL);

    Where you have ZERO should be the desired length of your array.

    It is pretty apparent to me that you don’t know how to use the API. I believe the documentation relavent to your question can be found at:

    https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_NewArrayObject

    https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_DefineProperty

    https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_DefineElement

    and:
    https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JSClass.addProperty

    https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JS_PropertyStub

    These five pages have all the info you should need to crack the code.

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

Sidebar

Related Questions

Actually my code is: LinearLayout ll = new LinearLayout(this); ll.setId(i); ll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); ll.setPadding(0, 0,
i'm new with python.. Actually, i'm trying to send featured email with python: html
I have both Eclipse 3.5 and 3.6 on ubuntu 10.04. I am trying, actually
I'm new to Doctrine, and I'm trying to get my head around both Doctrine
I'm trying to do something every time a new tab opens up, both via
I found this interesting thing when I was trying out the new feature optional
My intention is to create a new field. Actually I need few fields: AdditionalAnswer
I am actually new at Qt and would be grateful if someone could explain
I'm using JSF 2.0 and it's new (actually old, but now incorporated in JSF)
Dear community members, I am actually a bit new to CSS, however I know

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.