Jump to content

what is this in JSON


Omirion

Recommended Posts

Hey guys,

So in short check the code out.

var objJSON = {
      first: 'something'
      func:function(){
        //where does THIS point to?
      }
      obj:{
            something:'foo'
            func2:function(){
                 //Where does this point to here
            }
      }
}

 

So basically i want to know how  this  ties into JSON.

Does it always point to the root object?

And if so how can i set up callpoints.

 

like lets say i have a multi levele object

m{

  a:{

      b:{

      }

      c:{

      }

  }

}

 

How can i set a callpoint that points to    a    rather than the root element    m.

Link to comment
Share on other sites

That's what i meant. In an object created with JSON notation.

 

Ah, now I'm with you.

 

var objJSON = {
      first: 'something',
      func:function(){
        // this would point to ObjJSON
      },
      obj:{
            something:'foo',
            func2:function(){
                 // this would point to obj
            }
      }
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.