Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
47
rated 0 times [  52] [ 5]  / answers: 1 / hits: 37502  / 15 Years ago, mon, october 5, 2009, 12:00:00

The documentation of some JavaScript APIs shows the following snippets as an example of how to invoke some function:



<button type=button onClick=foo.DoIt(72930)>Click</button>

<button type=button onClick=foo.DoIt(42342::37438)>Click</button>


:: is obviously used here to allow either one or two arguments to be passed to the function.



What does :: do in JavaScript?



And how does the function know if one or two values were passed? How does it read them?






On closer look, the examples show other weird stuff like



<button type=button onClick=foo.Bar(72//893)>Click</button>

<button type=button onClick=foo.Qux(425;1,34::)>Click</button>


At least the // looks just wrong.



So I guess it's not some fancy new syntax that I'm not aware of, but maybe the examples are just missing quotes around a single string argument.


More From » syntax

 Answers
39

Nothing. It is a syntax error.



>>> alert(42342::37438)
SyntaxError: missing ) after argument list

[#98571] Tuesday, September 29, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
albert

Total Points: 652
Total Questions: 105
Total Answers: 108

Location: Pitcairn Islands
Member since Fri, Oct 15, 2021
3 Years ago
;