I think this may be a duplicate of Strict Violation using this keyword and revealing module pattern
I have this code:
function gotoPage(s){
if(s<=this.d&&s>0){this.g=s; this.page((s-1)*this.p.size);}
}
function pageChange(event, sorter) {
var dd = event.currentTarget;
gotoPage.call(sorter, dd[dd.selectedIndex].value);
}
And JSHINT (JSLINT) is complaining. It says “Strict violation.” for the highlighted line:

Is my use of Function.call() and then referencing the instance, somehow inappropriate?
Is this considered to be bad style?
JSHint says “Possible strict violation” because you are using
thisinside something that, as far as it can tell, is not a method.In non-strict mode, calling
gotoPage(5)would bindthisto the global object (windowin the browser). In strict mode,thiswould beundefined, and you would get in trouble.Presumably, you mean to call this function with a bound
thiscontext, e.g.gotoPage.bind(myObj)(5)orgotoPage.call(myObj, 5). If so, you can ignore JSHint, as you will not generate any errors. But, it is telling you that your code is unclear to anyone reading it, because usingthisinside of something that is not obviously a method is quite confusing. It would be better to simply pass the object as a parameter: