Sign in Go Pro

Beginning JavaScript for React Native

What is 'this'?

 
Autoplay

Up next

Previous

About

The value of this within a JavaScript function is set to whatever object called that function. This can be a very helpful and powerful feature, but can also cause a lot of errors and confusion.

There are a few ways to set the value of this withing a function, including the bind method, using call or apply to call the function, or using arrow functions instead of defining functions in the traditional way.

Summary of Content:

  • Getting the value of this in the current context
  • The value of this changes based on what called the function
  • How to fix the value of this for all time, or just for one function call

Resources:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Beginning JavaScript for React Native