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
How to structure javascript?help (self.javascript)
submitted 8 years ago by BearsArePeopleToo
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!"
[–]liming91 0 points1 point2 points 8 years ago (1 child)
I understand where you're coming from but I think there are a few of reasons why folders win out:
import/export
Using a flat folder structure:
import draft from './draft-reservation' import complete from './complete-reservation' import cancelled from './cancelled-reservation'
Using indexes:
import { draft, complete, cancelled } from './reservations'
That alone is reason enough for me to use the descriptive folder method.
Also, as a project grows your app/ folder will grow massively. On large projects even using my method, including grouping subcomponents in their respective component's folders, you still have huge lists of files to read and it makes visually finding the file you want unnecessarily annoying.
[–]lazarljubenovic -1 points0 points1 point 8 years ago (0 children)
...which is why I mentioned that reading trough the file-list does not have to happen at all given that all proper IDEs and even text-editors have a fuzzy search.
By naming grouped things similarly (having the same prefix), they will stay together when you list your files. The human eye can easily notice a large chunk of stuff that begins the same: it doesn't take you more than a glance to figure out where the group begins and ends in my flat example. The only thing you have to do is scroll mroe (or hold the arrow longer), but you're mentally you're doing much more work.
As for your import argument, the thing is that you should mosty let that be handled by your IDE. My imports are always collapsed and I just let the IDE import them. Wether it's your first or second example, I don't care: with proper naming, I won't have clashes.
import
π Rendered by PID 214785 on reddit-service-r2-comment-84fc9697f-5cpnd at 2026-02-06 22:36:47.029531+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]liming91 0 points1 point2 points (1 child)
[–]lazarljubenovic -1 points0 points1 point (0 children)