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

  • Home
  • SEARCH
  • 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 8463071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:21:51+00:00 2026-06-10T14:21:51+00:00

I have an object this.themeData something like this (console output shown) Object Banner: Object

  • 0

I have an object this.themeData something like this (console output shown)

Object
    Banner: Object
        property: "null"
        raw: "uploads/1/somefile.png"
        selector: "null"
        value: "../../uploads/1/somefile.png"
        __proto__: Object
    H1_FontSize: Object
    H2_FontColor: Object
    H2_FontSize: Object

and I loop through like this:

    for (attrName in this.themeData) {
        attrData = this.themeData[attrName];
        if (attrData.selector && attrData.value) {
            $(".SomeSelector").css(attrData.property, attrData.value);
        }
    }

This works, but I saw in a recent SO question that I shouldn’t use for in. But how can I loop through if the indexes are not numeric values for(var i = 0; i<arr.length; i++) where this.themeData[i] doesn’t exist ?

  • 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-10T14:21:53+00:00Added an answer on June 10, 2026 at 2:21 pm

    It’s fine to use for..in loops on Objects, you just need to filter them with a hasOwnProperty() check

    for (attrName in this.themeData) {
        if (this.themeData.hasOwnProperty(attrName)) {
            attrData = this.themeData[attrName];
            if (attrData.selector && attrData.value) {
                $(".SomeSelector").css(attrData.property, attrData.value);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this object below: I thought about putting the messages in html like
I have an object with a property called name. This object has a sub
I'm just wondering .. I have and object like this public class Entry{ public
While exercising your DDD skills, suppose you have object like this: class Person {
Suppose I have a design like this: Object GUI has two objects: object aManager
I have this object: stdClass Object ( [daily_inventoryID] => 1 [inventory_timestamp] => 2012-06-08 14:35:42
I have this object I'm loading with THREE.objLoader and then create a mesh with
I have this object: class a { public string Application; public DateTime From, To;
I have this object which is an instance of a superclass. I want to
Let's say I have an object - a User object in this case -

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.