Welcome Guest! (App Version 3.1)

websitnero logo name

Concept of This

What is 'this' in JavaScript?

This in JavaScript simply refers to the 'object' inside which current function is being executed. Most often 'this' will refer to the 'window object' but when inside some object property, which is function, then 'this' will refer to that object.

Example

<script>

alert(this); //returns window object

var obj1 = new Object;
obj1.name = "Peter";
obj1.fn1 = function(){
  alert(this); //returns obj1
}

obj1.fn1();

</script>
WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.