Skip to main content
We can review your code, but not discuss a practice in general with this code merely serving as an example; edited tags
Source Link
200_success
  • 145.7k
  • 22
  • 192
  • 481

Extensive use of nested functions to avoid polluting Quicksort in JavaScript, using nested functions

For example, checkCheck out this quicksort code:

So, is it a good practice to use likeIs this nesting appropriate? Because I(beginner) feel like if the nested functions are big, the readability(I mean like figuring out what the code is doing) is an issue.

And also any advice to improve the above code is welcome.

Thank you.

Extensive use of nested functions to avoid polluting in JavaScript

For example, check out this quicksort code:

So, is it a good practice to use like this? Because I(beginner) feel like if the nested functions are big, the readability(I mean like figuring out what the code is doing) is an issue.

And also any advice to improve the above code is welcome.

Thank you.

Quicksort in JavaScript, using nested functions

Check out this quicksort code:

Is this nesting appropriate? Because I(beginner) feel like if the nested functions are big, the readability(I mean like figuring out what the code is doing) is an issue.

And also any advice to improve the above code is welcome.

deleted 83 characters in body
Source Link

Sorry for the title. It is best way I can put up to describe my situation/need.

I come from Java/Swift environment. So, I'm used to show the user of my code only "what is necessary".

Sorry for the title. It is best way I can put up to describe my situation/need.

I come from Java/Swift environment. So, I'm used to show the user of my code only "what is necessary".

I come from Java/Swift environment. So, I'm used to show the user of my code only "what is necessary".

added 432 characters in body
Source Link

A simple code breaking example:

For the user of the sort(), partition() and quickSort() is an unnecessary functions. Which in-turn can cause collisions if the user names their function partition() (because I might not have mentioned partition() in my API as it is not usable on its own).

And also any advice to improve the above code is welcome.

And also any advice to improve the above code is welcome.

A simple code breaking example:

For the user of the sort(), partition() and quickSort() is an unnecessary functions. Which in-turn can cause collisions if the user names their function partition() (because I might not have mentioned partition() in my API as it is not usable on its own).

And also any advice to improve the above code is welcome.

Source Link
Loading