Is there a better way to write insertion sort? Background

I am doing an insertion sort and I would like it to be as efficient as the algorithm allows. 

Code

After much research, this is what I made: 

const isFunction = require("lodash.isfunction"); //copy pasta from lodash :D

const insertion = ( array ) =&gt; {

    if(!Array.isArray(array))
        throw new Error("array must be an Array");

    if (array.length === 0)
        return [];

    //shallow copy
    const clonedArray = array.slice();

    //Optimized iterative version: https://en.wikipedia.org/wiki/Insertion_sort
    let i = 1, j, temp;
    while( i &lt; clonedArray.length ){
        temp = clonedArray[i];
        j = i - 1;
        while( j &gt;= 0 &amp;&amp; clonedArray[ j ] &gt; temp ){
            clonedArray[ j + 1 ] = clonedArray[ j ];
            j = j - 1;
        }
        clonedArray[ j + 1 ] = temp;
        i = i + 1;
    }

    return clonedArray;
};

module.exports = insertion;


Questions

I tested the code and I know it works. But I wonder if the algorithm available in wikipedia is the best insertion sort algorithm. 

Having in mind I wish this function's API to be pure ( I don't want to change the original array, I want to return a new one), I have the following questions:


Is there a better way to code insertion sort?
What improvements can be made to this code?
Other than rewriting it in a less pseudo-code-like way:

const insertion = ( array ) =&gt; {

    if(!Array.isArray(array))
        throw new Error("array must be an Array");

    if (array.length === 0)
        return [];

    //shallow copy
    const clonedArray = array.slice();

    //Optimized iterative version: https://en.wikipedia.org/wiki/Insertion_sort
    let temp;
    for (let i = 1; i &lt; clonedArray.length; i++) {
      temp = clonedArray[i];
      for (let j = i-1; j &gt;= 0 &amp;&amp; clonedArray[j] &gt; temp; j--) {
        clonedArray[j + 1] = clonedArray[j];
      }
      clonedArray[j + 1] = temp;
    }

    return clonedArray;
};

module.exports = insertion;


There isn't much room for improvement from an algorithm perspective, since you're already using the optimized algorithm and you aren't doing anything unnecessary from a JavaScript perspective.

Rewriting it to use for() instead of while() won't have any real effect, other than it just looks less like pseudo-code and more like typical JS. It is really just a code style thing though, and open to opinion.

(Also, dropped isFunction() since you don't seem to use it, but that might just be copy-pasta from the rest of your code.)