Quicksort in JavaScript, using nested functions
Nesting functions
There is nothing wrong with your approch, a few years back and I would have not said so as some browsers would parse functions within functions each time they were call, with the obvious performance hit. That is a thing of the past and functions are parsed then cached for use next time the function is called.
Modules to keep global scope clean.
Modern JS has modules that let you define exports and then import them as needed in other modules
Each module has its own top level context and thus does not add to the global scope.
Use the export token to define what can be imported.
The only way to access items in the module is via the import token, and only those items explicitly exported.
Modules also use strict mode by default.
Thus you can flatten you code without worrying about name conflicts.
If you create a default export in a module you can also import it under another name.
Example of a module, and flatting your quick sort.
/* in file quickSort.js */
export default function sort(array) {
    quickSort(array, 0, array.length - 1);
}

function quickSort(array, start, end) {
    if (start &lt; end) {
        let pivot = partition(array, start, end);
        quickSort(array, start, pivot - 1);
        quickSort(array, pivot + 1, end);
    }
}

function partition(array, left, right) {
    let pivot = array[right];
    let i = left - 1;
    for (var j = left; j &lt; right; j++) {
        if (array[j] &lt;= pivot) {
            i++;
            let temp = array[j];
            array[j] = array[i];
            array[i] = temp;
        }
    }
    let temp = array[i + 1];
    array[i + 1] = array[right];
    array[right] = temp;
    return i + 1;
}

To access it from another module
import sort from &quot;quickSort&quot;;
sort([4,3,6,3,7,8]);

Or use another name, but only for the default export.
import qSort from &quot;quickSort&quot;;
qSort([4,3,6,3,7,8]);

Note that modules must be in files for both export code and import code, and the script element must be of type &quot;module&quot; eg &lt;script type=&quot;module&quot; src=&quot;quickSort.js&quot;&gt;&lt;/script&gt;
Also as a convention not a requirement modules have the extension .mjs rather than .js and some will use .es.mjs. They all have the same MIME type text/javascript
Singleton
Before modules it was common to use the singleton (AKA immediately invoked function) to reduce or completely eliminate any intrusion to the global scope.
Example of a singleton
const sort = (() =&gt; {
    function sort(array) {
        quickSort(array, 0, array.length - 1);
    }

    function quickSort(array, start, end) {
        if (start &lt; end) {
            let pivot = partition(array, start, end);
            quickSort(array, start, pivot - 1);
            quickSort(array, pivot + 1, end);
        }
    }

    function partition(array, left, right) {
        let pivot = array[right];
        let i = left - 1;
        for (var j = left; j &lt; right; j++) {
            if (array[j] &lt;= pivot) {
                i++;
                let temp = array[j];
                array[j] = array[i];
                array[i] = temp;
            }
        }
        let temp = array[i + 1];
        array[i + 1] = array[right];
        array[right] = temp;
        return i + 1;
    }
    
    return sort;
})();

sort([4,3,6,3,7,8]);