Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

why does javascript let you write a function without the parentheses

var numbers = [3, 10, 9 , 6];

function compareNums(a, b){
  return a - b;
}

numbers.sort(compareNums);

console.log(numbers); // outputs [3, 6, 9, 10]
Source by teamtreehouse.com #
 
PREVIOUS NEXT
Tagged: #javascript #write #function #parentheses
ADD COMMENT
Topic
Name
2+5 =