1

Has anyone ever come across a function syntax like given below in javascript or jquery. It is there in my project and I am not able to figure out what it is.

 function a::b(arg1, arg2)
 {}
user2472968
  • 377
  • 2
  • 5
  • 15

3 Answers3

6

No, that's invalid javascript. So if you ever come across such syntax you have 2 choices:

  • If you are the author of this code, fix it.
  • If you are not the author (like you saw it in a plugin or something) notify the author so that he can fix it
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • 2
    Verified that this does not exist in the ES6 specification draft either, they use it to indicate parts of the grammar bnf but it has no meaning except for that and is not a valid language construct. I think OP might be seeing typescript or some macro or something – Benjamin Gruenbaum Jul 03 '13 at 09:34
2

you can either use normal function

function xyz(){} or you can use singleton

xyz:function(){}

0

This is invalid javascript syntax:

enter image description here

raam86
  • 6,785
  • 2
  • 31
  • 46
  • 1
    I don't think this answer adds anything over what Darin said over 5 minutes ago. – Benjamin Gruenbaum Jul 03 '13 at 09:34
  • @BenjaminGruenbaum And the answer doesn't add to the comments. I do not think this warrants a downvote. – raam86 Jul 03 '13 at 09:39
  • 1
    Downvotes do not indicate I like or dislike you or your answer. I don't think the answer is bad, or incorrect or anything like that. Rather, downvotes indicate usefulness, or lack of it. Downvotes indicate "This answer is not useful", and upvotes indicate "This answer is useful". I did not find it useful (since it pretty much says what Darin said earlier, only less elaborately) so I down-voted it. Please do not take any offense in that. Your effort is recognized and I know you were trying to help, this is part of the reason down votes only cost 2 rep and up-votes generate 10. – Benjamin Gruenbaum Jul 03 '13 at 10:24
  • @BenjaminGruenbaum Thank you. No offense taken of course. It is the Internets after all. – raam86 Jul 03 '13 at 10:37