get the app get the app       get the app       get the app
What do you understand by this keyword in JavaScript?


  • : 247
  • : 7
    Previous Next

    In JavaScript the this is a context-pointer and not an object pointer. It gives you the top-most context that is placed on the stack. The following gives two different results (in the browser, where by-default the window object is the 0-level context):

    var obj = { outerWidth : 20 };

    function say() {
    alert(this.outerWidth);
    }

    say();//will alert window.outerWidth
    say.apply(obj);//will alert obj.outerWidth

    you can suggest other answer in comment box


  • Exam: Java Script Interview QUESTIONS





    Recommended Learning for you

    Close(X)
    Subscribe here for free mock test on IAS PCS SSC and other competitive exam. Signup here to get SSC CGL Solution and main exam study material