I got this open source JS project and trying to browse the code I found this several times:
if(evt.success){
;
evt.success(response.result);
}
An empty line ending with a ";"
Does this mean something ? or it's just a typing error ?
I got this open source JS project and trying to browse the code I found this several times:
if(evt.success){
;
evt.success(response.result);
}
An empty line ending with a ";"
Does this mean something ? or it's just a typing error ?
It is perfectly valid. It will just be treated as an empty line/statement and nothing will happen. But it does not mean anything special that you need to worry about if you were to remove it.
As to why it's in your code I don't know. If it was just a single instance I would go with a typo, but multiple instances I would say either on purpose, or a result of some code generation perhaps (and it could be a typo in that), or some other reason - we cannot know without finding the person who made the decision to include it.
valid statement that does nothing, so you can delete it, so you don't have to look at it, without worry
This is one of the approach to defensive programming in javascript. Consider something like this:
var y=x+f
(a+b).toString()
This will be interpreted as:
var y=x+f(a+b).toString()
Using ; before the beginning of statement eliminated problems like above.