I am trying to evaluate an anonymous JavaScript function using JSLint. However, JSLint fails evaluating it because the function is missing a name. What option can I set to allow JSLint to ignore that error?
Something like:
function(test) {
return;
}
Results in:
Missing name in function statement.
function(test) {
EDIT: To clarify, the anonymous function will be used as a view for CouchDB. I want to ensure that the syntax is correct before it hits the DB.
You can make a JavaScript function non-anonymous by using one of the following techniques:
Give the function a name:
function myFunction(test) {
return;
}
Assign the function to a variable:
var myFunction = function(test) {
return;
}
In fact, you can combine both approaches, but i wouldn't recommend that:
var myFunction = function myFunction(test) {
return;
}