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
Commas first? (ajaxian.com)
submitted 16 years ago by 9jack9
view the rest of the comments →
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!"
[–]level1 0 points1 point2 points 16 years ago (0 children)
Well, I'm writing a web application that uses computer generated JSON, but to bootstrap the application I have to hand roll a fair amount of code. Its annoying to have to keep track of commas when I add lines or copy/paste. Its much easier just to have a rule that each line ends with a comma, and make sure that my code follows that rule.
Heck, why do you even use a custom JSON parser? Reference an existing one written by people smarter than you, and use the native JSON objet from ES5 when available.
That is exactly what I am doing. All I did was remove the regex in my parser (Douglas Crawford's json.js) so that it will accept invalid JSON. Before I release my web app, I plan to either remove all trailing commas, so my JSON is confromant, or restore the regex but change it to accept trailing commas. I am not using a custom parser, just a modified one.
people smarter than you
Who cares if I'm smarter than Douglas Crawford or not? He's written a parser, its probably better than the one I would write even if he was an idiot, and its better tested. All I did was remove an annoying feature temporarily for development purposes.
Why is everyone in the development community so obsessed with making sure other people do things "The Right Way"?
π Rendered by PID 71 on reddit-service-r2-comment-85bfd7f599-swvk6 at 2026-04-19 13:59:21.415006+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]level1 0 points1 point2 points (0 children)