TypeError: Result of expression 'input.replace' [undefined] is not a function
<p>I wrote the following function in javascript:</p>

<pre><code>function maskString(input) {
  return input.replace(/\s\s+/," ");
}
</code></pre>

<p>Very simple.
In a second function I wrote:</p>

<pre><code>function secondFunction(string1, string2) { //Attetion! See Update 2!
  var string1masked = maskString(string1);
  var string2masked = maskString(string2);
  ( ... )
}
</code></pre>

<p>The error message is:
<code>TypeError: Result of expression 'input.replace' [undefined] is not a function.</code></p>

<p>Anybody an idea? Google wasn't really helpful :\</p>

<p><strong>UPDATE 1:</strong><br>
I'm using jQuery and string1 is from an textbox. I'm calling the second function like this:</p>

<pre><code>var bool = secondFunction (textarea1.val(), textarea2.val()); //Attetion! See Update 2!
</code></pre>

<p><strong>UPDATE 2:</strong><br>
I was wrong with the second function ... It's:</p>

<pre><code>function secondFunction(string1, array1) {
  var string1masked = maskString(string1);
  var array1masked = maskString(array1);
  ( ... )
}
</code></pre>

<p>So my function doesn't work with the array. Unfortunately I have no idea how to change it :(</p>
