In SAP UI5, var that = this is a common technique used to maintain a reference to the correct context of this.
In JavaScript, the value of this keyword inside a function can change based on how it is invoked. When a function is called as a method of an object, this refers to the object. However, when the same function is called without an object reference, this refers to the global object (in non-strict mode) or undefined (in strict mode).
To maintain the reference to the correct context of this inside a function in SAP UI5, developers commonly create a local variable called that and assign this to it, like this:
var that = this;
Then, inside the function, they can use that instead of this to refer to the correct context. This technique is often used in event handlers and callbacks to ensure that this always refers to the correct object.