Sometimes
asked on
optional variable in javascript
Is there there a way to specify an optional variable in a function call, then set it to a value if nothing is passed through
ie
function test(variable1, variable2 optional=0 )
then used test(1)
variable1 = 1 and variable2 = 0
Thanks
ie
function test(variable1, variable2 optional=0 )
then used test(1)
variable1 = 1 and variable2 = 0
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No it doesn't. You could however always use: test(null, 12) and add an additional if-clause to the test() function.
Having calls like test(,,,,,12) however sound a bit VB-ish to me.. :^)
-r-
Having calls like test(,,,,,12) however sound a bit VB-ish to me.. :^)
-r-
ASKER