0

In a Javascript code example, I saw a professional use a variable instead of the constant this:

var self = this;
self.[global_variable] = 0;

why do people use a different variable? for some reason, I tried replacing self with this

this.[global_variable] = 0;

didnt work? How does this happen?

user3853858
  • 235
  • 1
  • 4
  • 10

0 Answers0