DEV Community

loading...

Discussion on: How do you order your functions?

Collapse
functional_js profile image
Functional Javascript • Edited

I use arrow funcs exclusively, thus ordering by definition before invocation is runtime enforced. ;-)

Most of my modules have one func.
My utility modules have many funcs, but order doesn't matter since there is no dependencies between any of them; if anything they're arranged by general similarities.

But that's also trivial because I get to a func by hitting F12, or alt-F12 to get preview-popup. If I'm in the utility module, I use ctrl/cmd-shift-period to pull up the list of funcs. You can also type in that list to highlight the func you want, then hit enter to go to it.

So where a func is inside of a code file is the least of my concerns.
The more common concern is pondering, "Do want to pull this func out into its own module?"

Forem Open with the Forem app