Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

return early pattern for functions javascript

function abTest(a, b) {

  if (a < 0 || b < 0){
    return undefined;
  }

  return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

abTest(2,2);
 
PREVIOUS NEXT
Tagged: #return #early #pattern #functions #javascript
ADD COMMENT
Topic
Name
3+5 =