Create string from exsting string in which every character is represented by * and only space represented by space
<p>I want to generate a new string from an existing string.<code>javascript</code> In the new generated string all characters would be presented by '*' except ' ' (space).
For example if existing string is </p>

<p><BR>"hide me"<BR></p>

<p>then new genrated string would be</p>

<p><BR> <code>"**** **"</code><BR></p>

<p>I tried like this, but it is not working.  </p>

<pre><code> function hiddenData()
{
var size = word.length;
for (var i = 0; i &lt;= size; i++)
{
    if (word[i] == ' ') {
        hiddenStr[i] = ' ';
    }
    else
    {
        hiddenStr[i] = '_';
    }
}
hiddenStr[i] = '\0';
}
</code></pre>

<p>Sorry for my poor explanation, </p>
