"How does the JavaScript`this` keyword work?"

I gazed around with my blood-shot eyes like a starving beast and a mad man rolled into one. I searched for a perfect way to understand `this`. But, all I found was bits and pieces, scattered all over the place.

It hurt but I had no choice. To get better clients and better jobs, there was no way around it. I had to learn how `this` works.

Nothing seemed to explain `this` really well. I'd think I got it. Then, 30 seconds later it was as if I hadn't even read anything.

So... I dug in. Deeper.

I'd read. Then try it out. It would fail. Then, I'd make it work. Then it would fail again. I'd hate myself in secret, ashamed of the fact that I didn't really get `this`.

It was all so confusing I almost gave up on myself.

And then I discovered something.

There is a method to `this` madness.

You may already know that JavaScript is weird. But, a thing ( or a person! ) is only weird when you don't understand them. (When you give them a chance though...)

What I discovered is simple. There is a predictable way to figure out what `this` means. There are only a few possibilities when it comes to what `this` could be in a specific script. Once you've grasp those bits, you'll never be scared of `this` ever again.

You'll be able to to use `this` in your own scripts. In a job interview, you will explain how `this` works - with ease and confidence. Plus, you will know what it means when you're reading other people's code.

Here is the best part.

If you can follow simple steps, you can be a master of `this`.

If you want to be notified...

Self-taught developers: tips for writing code that gets you hired! Join now!