|
| 12 Mar 2013 03:37 PM |
does javascript require a semi colon after every line?
I'm kind'f confused, if not, what lines require it?
|-MassiveGman-| ~|Law Of Inertia|~ |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 12 Mar 2013 03:38 PM |
WNTS oh wait.
http://inimino.org/~inimino/blog/javascript_semicolons |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2013 03:39 PM |
It does not require it, however, you should. It will not operate consistently across all browsers under all circumstances if you don't provide semicolons.
A semicolon should appear at the end of every statement (e.g., anything not a control structure.) |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2013 03:39 PM |
Any line that isn't flow control. if(bool){ --Doesn't need semicolon foobar = true; --Does, since you are just doing arbitrary code }
Although, I think you can put semicolons after }'s and it will just ignore them. |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2013 03:39 PM |
No, not EVERY line.
It usually requires semicolons after defining a function, like after each line, and sometimes variables. |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2013 03:39 PM |
Seriously? bleh
big change from Lua, I'll tell you that.
> :C
|-MassiveGman-| ~|Law Of Inertia|~ |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2013 03:41 PM |
| Basically every other language does the exactly same thing, sooooo good luck with that. |
|
|
| Report Abuse |
|
|
|
| 12 Mar 2013 03:51 PM |
thanks for the luck c:
|-MassiveGman-| ~|Law Of Inertia|~ |
|
|
| Report Abuse |
|
|