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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:50:42+00:00 2026-05-27T18:50:42+00:00

How can express this javascript object defintion in a way that value of first

  • 0

How can express this javascript object defintion in a way that value of first InvoiceNo does not get replaced with second value?

EDIT< Ultimately i want an object called myObject that contains an array of Invoice numbers. Each invoice number would have a related bill and ship number…

var myObject = {};

myObject = { "InvoiceNo" : 44444, 
             "Shipping":
                {
                    "ShipTo": 22345 , "BillTo": 43456 
                }
            }

// some more code here that would capture user input or a data from a remote data feed...

myObject = { "InvoiceNo" : 555555, 
             "Shipping":
                {
                    "ShipTo": 32345 , "BillTo": 33456 
                }
            }
  • 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-27T18:50:43+00:00Added an answer on May 27, 2026 at 6:50 pm

    You could make something simple like this:

    var myObject = [
        {
            "InvoiceNo": 44444,
            "Shipping": { "ShipTo": 22345, "BillTo": 43456 }
        },
        {
            "InvoiceNo": 555555,
            "Shipping": { "ShipTo": 32345, "BillTo": 33456 }
        }
    ];
    console.log(myObject[0].InvoiceNo); // 0 - the first object inside the array
    console.log(myObject[0].Shipping.ShipTo); // access the "ShipTo" property of the first element
    

    For something more complicated JSON Wikipedia and JSONLint to validate.

    JsFiddle demo

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

Sidebar

Related Questions

Hopefully I can express this in a coherent and meaningful way: Two of our
Can anyone suggest a good source control system that interfaces with VB2005 Express? As
Where can I get the 64 bit bootstrapper for SQL Server Express 2005 64
Can I express this in an XSD? For example: One element is a required
I want to get smarter in AJAX, but not sure which way to go.
With Oracle (or DB2, HSQLDB), I can express things like this: MERGE INTO [target_table]
In SQL you can express multiple aggregates in a single database query like this:
How can express this imperative function in a functional, array-based language like K (or
In this very simple ASP.NET application, Visual Web Developer 2008 Express CAN debug the
How can I get two separate ASP.NET sites, in this case a Web Site

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.