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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:08:02+00:00 2026-05-27T07:08:02+00:00

I have an object that looks like this: var MyObject = { prop1 =

  • 0

I have an object that looks like this:

var MyObject = {
prop1 = 12345,
prop2 = "string1",
ListOfOtherObject = an array of another type of object,
ListOfAnotherObject = an array of objects}

Let’s say I have two objects: Object1 and Object2. Object2 was initially a deep-copy of Object1 and it was modified through the user’s interactions with the UI. I’m looking to get the difference between both objects, especially when it comes to the arrays.

For instance, ListOfOtherObject in Object2 might contain a modified version of some objects as well as new objects.

I’m thinking about looping through each array and then looping through each object within but there might be some more efficient way to do it, especially with jquery. Or may be going with JSON.stringify and compares strings and retuns some sort of string difference. I was wondering if anyone had any suggestions on how to do this.

Thanks.

  • 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-27T07:08:03+00:00Added an answer on May 27, 2026 at 7:08 am

    You need to specify what your comparison needs to do. For example, given:

    var o = {name: 'fred'};
    var p = {name: 'fred'};
    var a = {o:o};
    var b = {o:o};
    

    then:

    a == b;     // false, a and b are different objects
    a.o == b.o; // true since a.o and b.o reference the same object
    

    but if comparing objects:

    b.o = p;
    a.o == b.o; // false since a.o and b.o reference different objects
    

    or if comparing primitives:

    a.o.name == b.o.name; // true since the value of both expressions is the string 'fred'
                          // even though a.o and b.o are different objects
    

    Does Type or constructor matter? What about:

    b.o = [];
    b.o.name = 'fred';
    
    a.o.name == b.o.name;  // true or false? a.o is an object, b.o is an array 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object structure that looks like this: var Results = new List<ResultObj>()
I have a JavaScript object that looks something like this: var myTextOptions = {
I have a javascript object that looks somthing like this: var obj = {
I have a list of objects MyObject and that looks like this: var Obj1
I have an object that looks like this: var obj = { a: text,
Let's say that I have a object that looks like this var object =
I have an object that contains another object with translations. It looks like this:
I have a data object that looks like this: { 'node-16': { 'tags': ['cuda'],
I have a JSON object that looks like this. [ { id : 23,
I have an object that looks like: var object = [ {begin:0, end:20}, {begin:30,

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.