Understanding ‘this’ in JavaScript and determining it’s value in 4 simple steps

Every frontend developer at some point of his career has stumbled into thisin JavaScript and my bet is the first experience wasn’t very clear.

It turns out that in fact this in JavaScript can be understood and that we can even follow a simple 4 step procedure to determine it’s value.
Let’s solve this riddle.

Introduction

If you are looking into thisit probably means one of the three things: