Misunderstanding of the syntax


in the code below how the computer understand that (number=6), despite there is no variable declaration.
in the first row, the variable divideByThree is a function so I assume it should equal the result of this function!

so is it automatically defined as a variable when it's inside the brackets (), and what if there are many inside ()?

var divideByThree = function (number) {
    var val = number / 3;


a function parameter (number) serves as a placeholder till you supply an argument at function call (6 in this case)

if the number of parameters and arguments don't match, you get an error


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.