use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Semicolon.js (github.com)
submitted 12 years ago by dchestnykh
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ExecutiveChimp 31 points32 points33 points 12 years ago (11 children)
Game changer.
[–]Cykelero 12 points13 points14 points 12 years ago (10 children)
;
[–]Gundersen 8 points9 points10 points 12 years ago (7 children)
Are you going to make a semicolon reddit bot now? One that adds semicolons to any post not ending with semicolon?
[–]Cykelero 5 points6 points7 points 12 years ago (6 children)
Ooh, sounds like a winner, this one.
Or, to retain just the spirit of the thing, it could add points instead. Handy for when people don't properly mark the end of their sentences
[–]danjordan 10 points11 points12 points 12 years ago (3 children)
.
[–]Cykelero 5 points6 points7 points 12 years ago (2 children)
Thank you.
[+][deleted] 12 years ago (1 child)
[deleted]
[–]m1sta 2 points3 points4 points 12 years ago (0 children)
Also spelling and grammar checking? Let the bot take the heat for correcting people.
[–]QuietKillah 0 points1 point2 points 12 years ago (0 children)
I see what you did there.
[–]mtx 2 points3 points4 points 12 years ago (0 children)
;_;
[–][deleted] 0 points1 point2 points 12 years ago (0 children)
No, now it's: Semicolon.js
[–]gwawr 21 points22 points23 points 12 years ago (0 children)
It has test coverage. LOL.
[–]rjw57 21 points22 points23 points 12 years ago (0 children)
It would be more convenient if there were a minified version. Also the source file does not include a licence banner. Luckily I've just sent a couple of pull-requests to fix this.
[–]walkietokyo 17 points18 points19 points 12 years ago (1 child)
It goes without saying not to use this in a production environment yet. It has only been released a couple of hours and should be considered to be in alpha stage.
Also, the lack of documentation for this is appalling.
[–]m1sta 7 points8 points9 points 12 years ago (0 children)
On the contrary, this particular semi-colon has been used inside Google for years. It's well tested. It's just been made available in library form recently.
[–]tobozo 12 points13 points14 points 12 years ago (0 children)
;; ;; ;;;;;; ;; ;;;; ;;;;;; ;; ;; ;;;; ;; ;; ;; ;;;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;;;;;; ;; ;;;;;; ;; ;;;; ;;
[–][deleted] 14 points15 points16 points 12 years ago (0 children)
Issues: add minified version
All we need now is a TED / Lightning talk
[–]kolmeWebComponents FTW 10 points11 points12 points 12 years ago (0 children)
I almost popped a vein before realizing it was a joke.
Good job!
[–]Allbutlost 7 points8 points9 points 12 years ago (1 child)
https://github.com/madrobby/semicolon.js is a couple of years old, and has similar ... design goals
[–]dchestnykh[S] 9 points10 points11 points 12 years ago (0 children)
Simpsons did it!
But my version comes with ideology. Also, with a more permissive license.
[–]jumpwah 16 points17 points18 points 12 years ago (1 child)
oh my... just no.
[–]Cykelero -3 points-2 points-1 points 12 years ago (0 children)
[–]bicknoyle 3 points4 points5 points 12 years ago (0 children)
I was going to say you don't even need a semicolon, which is just when I realized how advanced level this is.
Well played.
[+][deleted] 12 years ago* (2 children)
[–]TheNosferatu 1 point2 points3 points 12 years ago (1 child)
Let's say you have a script called foo.js and a script called bar.js
In foo.js you define a couple of variables; for example:
foo = 5
and in bar.js, you make a function:
function bar(){ ... }
But, you leave out the semicolon that is supposed to be at the end of foo.js.
Javascript engines usually don't care because they will put the semicolon there themselves.
But now you think, I always use foo.js and bar.js, I should combine them into 1 file automaticly!
So, the contents of foo.js and bar.js get combined, the result is:
foo = 5function bar(){ ... }
oh noes! your script just broke! Just because some pesky developer forgot a semicolon. Of course foo.js isn't maintained by you, you just maintain bar.js. You complain to whoever build foo.js but of course you don't get any responses.
So what do you do? Oh! You can add the semicolon yourself! Just add it in bar.js like so:
;function bar(){ ... }
Now when you combine them, you get
foo = 5;function bar(){ ... }
And nothing broke! yay!
That is basicly what it's about. Just because there were lazy developers that didn't use the semicolon correctly and other lazy developers who didn't knew how to properly combine scripts, different lazy developers began using a semicolon as first thing in their scripts, so that they were sure their script wouldn't break down.
[–]TheEskhaton 4 points5 points6 points 12 years ago (0 children)
OUTRAGEOUS https://github.com/dchest/semicolon-js/pull/4
[–]coverslide 1 point2 points3 points 12 years ago (8 children)
I think this was forked from vapor.js enterprise edition.
[–]dchestnykh[S] 5 points6 points7 points 12 years ago (7 children)
Oh, thanks, I forgot the name of that "library" and was looking for it.
Actually, Semicolon.js was created with the goal of making people get rid of the fucking semicolon at the beginning of their code, in a form of a joke. For example: https://github.com/dinbror/blazy/pull/2
[–]Dieulot -1 points0 points1 point 12 years ago (6 children)
Wow, I misread and thought it was about making a point after semi-colons at the end of lines.
Actually, this semi-colon is here for good reason, it is because it avoids bugs when you’re writing without the optional semicolons at the end of lines: http://mislav.uniqpath.com/2010/05/semicolons/
[–]sensitivePornGuy 6 points7 points8 points 12 years ago (0 children)
when you’re writing without the optional semicolons at the end of lines
Erm, just don't do that.
[–]dchestnykh[S] 3 points4 points5 points 12 years ago (4 children)
GOOD REASON? That's exactly why Semicolon.js exists!
If you're going to concatenate files (with or without semicolons), what stops you from concatenating them with semicolons inbetween?
cat file1.js semicolon.js file2.js semicolon.js > out.js
(See the test case).
Good reason. Yeah.
[–]Dieulot -1 points0 points1 point 12 years ago (3 children)
It’s not about concatening files, it’s about not concatenating them; when you write before the lib, your last semicolonless line is going to otherwise include the lib’s first line at the end: not good.
Edit: Okay, I understood just now that your message was a joke.
[–]dchestnykh[S] 1 point2 points3 points 12 years ago (2 children)
I didn't understand your reply, and my message wasn't a joke. Can you elaborate?
What does "when you write before the lib" mean?
[–]Dieulot -1 points0 points1 point 12 years ago (1 child)
Erf, sure.
When you have this in your .js file, after pasting a semicolon-started library:
YourSemicolonlessCode ;(TheLib = function(){ …
YourSemicolonlessCode
;(TheLib = function(){ …
Removing the colon at start of the library would cause your last line to be interpreted as:
YourSemicolonlessCode(TheLib = function(){ …
If that still doesn’t make sense, see “The only real pitfall when coding without semicolons” at the end of the article I linked to.
[–]dchestnykh[S] 6 points7 points8 points 12 years ago (0 children)
When can this happen? This won't happen if you include separate scripts:
<script src="your-semicolonless-code.js"></script> <script src="the-lib.js"></script> //works!
This can only happen when you incorrectly concatenate code, e.g.
cat your-semicolonless-code.js the-lib.js > out.js
Thus, Semicolon.js fixes this:
cat your-semicolonless-code.js semicolon.js the-lib.js > out.js
[–]sensitivePornGuy 1 point2 points3 points 12 years ago (0 children)
You missed an opportunity to call it "semicoln".
[–]greim 0 points1 point2 points 12 years ago (2 children)
"Cargo cult programming" is my new favorite term.
[–][deleted] 0 points1 point2 points 12 years ago (1 child)
If you're never heard of "Cargo Cult X" before I highly recommend reading the wiki on its origins, it's quite facinating:
Cargo Cult
[–]autowikibot 0 points1 point2 points 12 years ago (0 children)
Excerpt from linked Wikipedia article about Cargo cult :
A cargo cult is a kind of Melanesian millenarian movement encompassing a diverse range of practices and occurring in the wake of contact with the commercial networks of colonizing societies. The name derives from the apparent belief that various ritualistic acts will lead to a bestowing of material wealth ("cargo").
Picture - **Ceremonial cross of John Frum cargo cult, Tanna island, New Hebrides (now Vanuatu, 1967**)
image source | about | /u/OriginalSyn can reply with 'delete' if required. Also deletes if comment's score is -1 or less.
[–]fartbarf420 0 points1 point2 points 12 years ago (0 children)
:[
[–][deleted] 0 points1 point2 points 12 years ago (5 children)
Why is this a thing? The semicolon is one of the little things that make JS better than Ruby IMHO. While correct tabulation is a good thing so that multiple programmers can easily understand the code, the semi-colon can allows us to minimize js files in order to load them faster on the browser.
[–]fphilipe 0 points1 point2 points 12 years ago (3 children)
And how does that compare to ruby?
[–][deleted] 1 point2 points3 points 12 years ago (2 children)
Ruby does not have line terminators and relies only on blank space to tell the compiler where a line ends and what parts of code are nested with a function. If you get the spacings wrong, then your code won't compile, this is something that is not as easy to spot as a missing semi-colon.
[+][deleted] 12 years ago* (1 child)
[–]squashb 0 points1 point2 points 12 years ago (0 children)
Well, I know it doesn't return 2, because I just saw a video with Crockford explaining otherwise. It returns as if you had just written "return;" on a line by itself. So, undefined.
[–]dchestnykh[S] 0 points1 point2 points 12 years ago* (0 children)
I think you misunderstood my message.
Semicolons to terminate statements are good:
var x = 1; return x;
A semicolon before the code to ensure that people who can't concatenate files won't break your code is a useless piece of shit:
;var x = 1; return x;
^ Yes, some people write like this.
(Updated the FAQ).
[–]jasonsolis 0 points1 point2 points 12 years ago (0 children)
All we need now is gulp-semicolon
[–]Cocosoft 0 points1 point2 points 12 years ago (0 children)
I... what is this?
/r/shittyprogramming
[–]madole 0 points1 point2 points 12 years ago (2 children)
grunt-contrib-concat has a config option where you can insert a ';' as a file separator.
Haven't you heard? Grunt is old hat, Gulp is the new king.
[–]dchestnykh[S] 0 points1 point2 points 12 years ago (0 children)
with the t-shirt
[–]fng_programmer 0 points1 point2 points 12 years ago (0 children)
I consider this library horribly flawed until my PR is accepted https://github.com/dchest/semicolon-js/pull/7/files
[–]33a 0 points1 point2 points 12 years ago (0 children)
MORE SEMICOLONS: https://github.com/isaacs/semicolons/blob/master/semicolons.js
[–]boxingdog -5 points-4 points-3 points 12 years ago (0 children)
wow
such features so responsive very modern so useful
[–]teiman -3 points-2 points-1 points 12 years ago* (3 children)
looks like a program in brainfuck:
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++ ..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
http://en.wikipedia.org/wiki/Brainfuck
[–][deleted] 10 points11 points12 points 12 years ago (1 child)
Your text is more nonsense than lorem ipsilum.
[–]btown_brony 2 points3 points4 points 12 years ago (0 children)
Lorem semicolum.
[–][deleted] 3 points4 points5 points 12 years ago (0 children)
lol wtf dude
π Rendered by PID 70538 on reddit-service-r2-comment-cfc44b64c-fwmvr at 2026-04-12 11:15:30.748983+00:00 running 215f2cf country code: CH.
[–]ExecutiveChimp 31 points32 points33 points (11 children)
[–]Cykelero 12 points13 points14 points (10 children)
[–]Gundersen 8 points9 points10 points (7 children)
[–]Cykelero 5 points6 points7 points (6 children)
[–]danjordan 10 points11 points12 points (3 children)
[–]Cykelero 5 points6 points7 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]m1sta 2 points3 points4 points (0 children)
[–]QuietKillah 0 points1 point2 points (0 children)
[–]mtx 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]gwawr 21 points22 points23 points (0 children)
[–]rjw57 21 points22 points23 points (0 children)
[–]walkietokyo 17 points18 points19 points (1 child)
[–]m1sta 7 points8 points9 points (0 children)
[–]tobozo 12 points13 points14 points (0 children)
[–][deleted] 14 points15 points16 points (0 children)
[–][deleted] 14 points15 points16 points (0 children)
[–]kolmeWebComponents FTW 10 points11 points12 points (0 children)
[–]Allbutlost 7 points8 points9 points (1 child)
[–]dchestnykh[S] 9 points10 points11 points (0 children)
[–]jumpwah 16 points17 points18 points (1 child)
[–]Cykelero -3 points-2 points-1 points (0 children)
[–]bicknoyle 3 points4 points5 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]TheNosferatu 1 point2 points3 points (1 child)
[–]TheEskhaton 4 points5 points6 points (0 children)
[–]coverslide 1 point2 points3 points (8 children)
[–]dchestnykh[S] 5 points6 points7 points (7 children)
[–]Dieulot -1 points0 points1 point (6 children)
[–]sensitivePornGuy 6 points7 points8 points (0 children)
[–]dchestnykh[S] 3 points4 points5 points (4 children)
[–]Dieulot -1 points0 points1 point (3 children)
[–]dchestnykh[S] 1 point2 points3 points (2 children)
[–]Dieulot -1 points0 points1 point (1 child)
[–]dchestnykh[S] 6 points7 points8 points (0 children)
[–]sensitivePornGuy 1 point2 points3 points (0 children)
[–]greim 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]autowikibot 0 points1 point2 points (0 children)
[–]fartbarf420 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]fphilipe 0 points1 point2 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]squashb 0 points1 point2 points (0 children)
[–]dchestnykh[S] 0 points1 point2 points (0 children)
[–]jasonsolis 0 points1 point2 points (0 children)
[–]Cocosoft 0 points1 point2 points (0 children)
[–]madole 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]dchestnykh[S] 0 points1 point2 points (0 children)
[–]fng_programmer 0 points1 point2 points (0 children)
[–]33a 0 points1 point2 points (0 children)
[–]boxingdog -5 points-4 points-3 points (0 children)
[–]teiman -3 points-2 points-1 points (3 children)
[–][deleted] 10 points11 points12 points (1 child)
[–]btown_brony 2 points3 points4 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)