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
https://forums.phpfreaks.com/topic/224132-what-is-this-in-json/
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
            }
      }
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.