EDIT: Syntastic is configured to use JSLint
EDIT2: I am using JavascriptLint, not JSLint
On the below code syntastic warns function inside does not always return a value
function(){
switch(age){
case 1:
return 'won';
case 2:
return 'too';
case 3:
return 'tree';
default:
throw 'wow man, you are old!';
break; //technically redundant
}
}
I realize default
does not return a value, but the throw
ends the execution. Is this a Syntastic error, or should I change my coding style? Should I put a return
statement after throw
?