Hello all I am currently running JSLint on my files to clean them up.
I have file which have some private function and public function and i am making public function accessible to out side file using a variable.
Util.data = (function() {
var privar;
pri_func1 = function() {
//do something
},
pri_func2 = function() {
//do something
}
return { // JSLint error
pub_fun1: function() {
//do something
},
pub_fun2: function() {
//do something
}
}
})();
Now out side my this file i am accessing these function likes this
Util.data.bub_fun1();
Util.data.bub_fun2();
Its working fine. But now the from problem is that the JSLint is giving me an error on the return statement
#1 Unexpected ‘return’.
return { // Line 78, Pos 9
So I want to ask that is there a way to remove JSLint error in a way that i don’t have to change my other files and can call these function as it is that is
Util.data.bub_fun1();
Thanks alot any help will be appreciated.
Everything is fine. You just need to take care of little things. In this case
;is missing after declaring ‘pri_func2’.This should be enough for this error.