Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

minus function

function minus(a, b) {
  if (b === undefined) return -a;
  else return a - b;
}

console.log(minus(10));
// → -10
console.log(minus(10, 5));
// → 5
Source by eloquentjavascript.net #
 
PREVIOUS NEXT
Tagged: #function
ADD COMMENT
Topic
Name
9+2 =