4 ms·
There are defaults for all sorts of functions. find() functions on an array in many languages use some default. Parameters often have defaults when not set. Str
by yupper32 4y ago
There are defaults for all sorts of functions. find() functions on an array in many languages use some default. Parameters often have defaults when not set. Strings often have a default encoding.
The vast majority of the time, the default works well enough. Why make things more complicated than they need to be?
It also has the added benefits of helping more junior engineers when reading the code. "Cycle sort? What is that doing?" "Insertion sort? I was taught that was inefficient! I should spend time updating this code to a better sorting algorithm! My tech lead would love my initiative."
Or we just use sort(), and we all move on with our lives.