Web Analytics Made Easy -
StatCounter How to get the name of an object passed to a function - CodingForum

Announcement

Collapse
No announcement yet.

How to get the name of an object passed to a function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get the name of an object passed to a function

    I have a function that receives an object and I need to know the name of this object to determine the appropriate processing because I call the same function for a couple of objects. Is there a way to get the name of an object? Any help would be greatly appreciated.


  • #2
    Do you mean something like this?


    function do_this(obj){

    if(obj==name1){
    do this
    }

    if(obj==name2){
    do this
    }

    }
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

    Comment


    • #3
      Depends on what object you're passing. If the object has the name property, you can use obj.name
      Glenn
      vBulletin Mods That Rock!

      Comment

      Working...
      X