type error: object has no method of split
<p>I have been doing an exercise on codewars, however my code passes the tests but it gives a typeError. Couldn't figure out why. Be great if I could get some help... Thanks!</p>

<p>The task is to create a function that can take any string and randomly jumble the letters within each word while leaving the first and last letters of the word in place.</p>

<p>Here's my code:</p>

<pre><code>function shuffle(a) {
    var j, x, i;
    for (i = a.length; i; i--) {
        j = Math.floor(Math.random() * i);
        x = a[i - 1];
        a[i - 1] = a[j];
        a[j] = x;
    }
};

mixwords = function(string){

  var array = string.split(" ");

  for (var i = 0; i &lt; array.length; i++) {
    var itemArray = array[i].split("");
    if (itemArray.length &gt; 2) {
      var first = itemArray.shift();
      var last = itemArray.pop();

      shuffle(itemArray);
      itemArray.unshift(first);
      itemArray.push(last);
      var newItem = itemArray.join("");
      array[i] = newItem;
    }
  };
  console.log(array.join(" "));
  return array.join(" ");
};
</code></pre>

<p>The error message goes like this: </p>

<blockquote>
  <p>TypeError: Object 23 has no method 'split' at mixwords</p>
  
  <p>/runner/frameworks/javascript/cw-2.js:273</p>
  
  <p>throw ex;
                            ^</p>
</blockquote>