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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:40:14+00:00 2026-05-30T07:40:14+00:00

I have a javascript object, and I want to recursively search it to find

  • 0

I have a javascript object, and I want to recursively search it to find any properties that contain a specific value.

The javascript I’m working with has been minified, and is not so easy to trace through.

Background

I’m using the Bing Maps AJAX SDK. It has the ability to add additional tile layers. Each tilelayer has a tilesource object, which specifies the URI format for the tile URL.

I’ve ran into a problem where the tilesource URI is created once, and cached. Thus I can’t dynamically change the parameters of the URL (for example, to change the colors of the tile overlay based on the time of day) for each request.

Note that this behavior is different that Google’s Map API, and the Bing Maps api for WP7, which both allow you to dynamically create the URL for each tile request.

The cached URI is looked up, and two specific parameters are replaced, then the URI is used to fetch the tile.

Since this is javascript, I’d like to find the cached URI, and replace it with a function, that instead dynamically builds the URI, and returns it.

I don’t need to do this each runtime, just want and idea of where the property is being cached, so I can write code to hax0r it.

Original Question

If I set the URI to some value like “floobieblaster”, when I set a breakpoint, can I search the javascript object recursively for “floobieblaster” and get the property that is storing that value?

Edit to add

The object I’m searching appears to have a circular reference, thus any recursive code will likely cause a stackoverflow.

Are there any editor/debugger tricks I could make use of?

  • 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-30T07:40:16+00:00Added an answer on May 30, 2026 at 7:40 am

    Something simple like this should work:

    var testObj = {
        test: 'testValue',
        test1: 'testValue1',
        test2: {
            test2a: 'testValue',
            test2b: 'testValue1'
        }
    }
    
    function searchObj (obj, query) {
    
        for (var key in obj) {
            var value = obj[key];
    
            if (typeof value === 'object') {
                searchObj(value, query);
            }
    
            if (value === query) {
                console.log('property=' + key + ' value=' + value);
            }
    
        }
    
    }
    

    If you execute searchObj(testObj, 'testValue'); it will log the following to the console:

    property=test value=testValue
    property=test2a value=testValue
    

    Obviously, you can replace the console.log with whatever you want, or add a callback parameter to the searchObj function to make it more reusable.

    EDIT: Added the query parameter which allows you to specify the value you want to search for when you call the function.

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

Sidebar

Related Questions

I have a Javascript object that I want to pass in more parameters, but
I have a Javascript object that requires 2 calls out to an external server
I have a Javascript object that basically represents a Row in an .NET GridView.
I have a javascript that does this (http is your XMLHttpRequest object) var r
I currently have a Javascript function that uses a string to reference an object
I have a javascript object that I would like to update with data from
I have a Javascript object that I'm trying to use as a hashmap. The
I have the following JavaScript object. When the window resizes, I want it to
I have an object in Javascript that looks like this function MyObject(){ this.name=; this.id=0;
Possible Duplicate: How do I enumerate the properties of a javascript object? I have

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.