JSLint keeps giving me the following error whenever defining 2 functions:
Problem at line __ character _: Unexpected 'var'.
I have tried declaring all vars at the beginning of the script but this does not solve the issue. Tried digging through the web for an answer but cannot seem to find one.
var walk = function walker(node, func) {
//code
}
var disp= function display(){
//code
return d;
}
Try declaring them like this:
var walker = function (node, func) {
//code
};
var display = function () {
//code
return d;
};
The problem with:
var walk = function walker(node, func) {
//code
};
is JSLint expects walk
to be either assigned a function or the result of the function. If you want to assign a function to the variable, the variable name becomes an alias of the function. To make JSLint happy, it should be an anonymous function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With