Give help. Get help.

  • # February 22, 2018 at 8:55 am

    I have a function,

    function pranab(){
      return this;
    var obj = pranab;
    console.log(obj()); //Window object

    but if i create a object and assign this function inside this object, the,

    var obj = {
      name: pranab
    console.log(;//the object itself

    So, here what’s the deal with variable?Why variable not return the variable itself as a result.

    # February 22, 2018 at 2:21 pm

    I’m seeing it return the object property (it’s not a variable) itself.

    Edit – hmm… in Opera, not Firefox. That is odd. But from my limited knowledge about closures I would expect it to return the parent object anyway.

    # February 28, 2018 at 6:11 pm

    not sure what you are tryin to do?

    See Codepen

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.