Many times I’ve seen a semicolon used after a function declaration, or after the anonymous “return” function of a Module Pattern script. When is it appropriate to use a semicolon after curly braces?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You use a semicolon after a statement. This is a statement:
because it is a variable assignment (i.e. creating and assigning an anonymous function to a variable).
The two things that spring to mind that aren’t statements are function declarations:
and blocks:
Note: that same block construct without semi-colon also applies to
for,doandwhileloops.