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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:52:10+00:00 2026-05-31T11:52:10+00:00

I have a master product list that has a logical object structure: var myProducts

  • 0

I have a master product list that has a logical object structure:

var myProducts = {
     "productInfo":{
        "productVariations":[{
            "ID":XXXXXXX,
            "Attributes":{
                "edition":'professional',
                "license":"perpetual"
            }
        },
        {
            "ID":XXXXXX,
            "Attributes":{
                "edition":'standard',
                "license":"perpetual"
            }
        },
        .
        .
        .

I am trying to compare this to a dynamically generated object array created by a product configurator application I have built. This list looks like this once generated:

var zcs_edition = [{ edition="standard", license="perpetual"}, { edition="professional", license="perpetual" }]

using $.inArray to compare the elements like below doesnt seem to be effective:

$.each(myProducts.productInfo.productVariations,function(i, val){
//console.log(this.productID);
    //console.log(val.productAttributes  );
    //console.log($.inArray(val.productAttributes, zcs_edition ))
});

Am I doing something wrong here, I half expected this to work.

  • 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-31T11:52:11+00:00Added an answer on May 31, 2026 at 11:52 am

    First off there are two errors in you example: In your master product list you have the element Attributes, but in your code you are referring to it as productAttribute, and in your list zcs_edition you are using = instead of :.

    To your problem: You can’t compare objects like that in JavaScript. {a: 1, b: 2} == {a: 1, b: 2} will always return false, because they are two different object, even it the happen to have the same properties and property values.

    You’d need to use a function that iterates over the properties and compares them one by one. See for example: Object comparison in JavaScript

    This however means you can’t use $.inArray, because it can’t use a such a function. You’d have to iterate of the array yourself, too.

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

Sidebar

Related Questions

I have a repository named master which keeps product releases. It has several tags
In a Master page, I have this.... <ul id=productList> <li id=product_a class=active> <a href=>Product
I have a master page that contains an ASP.NET server side Menu control (System.Web.UI.WebControls.Menu)
I have a master branch in my project, that I use to pull changes
I have the following problem: We have a large product which is in master
I have an extension that uses the products list block to show the products
I have a simple JQuery Product list. When a user click an item, it
We have a company product (asp.net website) that gets compiled and distributed to our
I have a master view (_MasterLayout.cshtml) This has a Div, with an ID of
I'm inheriting a project that allows the customer to view a product list based

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.