JSHint “Possible strict violation.” when using `bind`

It is extremely hard to detect this case without running the code. You can use option validthis to suppress this warning:

"use strict";

var obj = {
    f: function() {
        this.prop = 'value';
        g.bind( this )();
    }
};

function g() {
    /*jshint validthis:true */
    console.log( this.prop );
}

It is to be noted that jshint comments are function scoped. So the comment will work for the function g and its inner functions, not just the next line.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)