javascript - Function has inconsistent return points -


when running intellij's inspections on javascript wrote, reports

function 'createpages' has inconsistent return points @ line 35

but i'm not sure means, or how solve issue.

the function looks this:

function createpages(noofcounts) {     var default_page = 1, default_count = 15;     if (noofcounts != "" && noofcounts != null) {         if (noofcounts > default_count) {             try {                 var tempval = parseint(noofcounts / default_count);                 jquery("#page").val(tempval);                 return true;             }             catch (e) {                 alert('error . ' + e);             }         } else {             alert("it should not less 15 , should number");             return false;         }     }     else {         jquery("#page").val(default_page);         return true;     } } 

and being called so:

var valid = createpages(noofcounts); 

your function (in effect) return undefined implicitly after reaches alert('error . ' + e);, because execution reach end of function without explicit return.

so making sure code paths through function return value explicitly rid of intellij error.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -