Discarding space or null character
<p>Will be a simple question, but not for me :) .</p>

<p>I was going through this code :</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;

&lt;h1&gt;My First JavaScript&lt;/h1&gt;

&lt;p&gt;Please input a number.&lt;/p&gt;

&lt;input id="demo" type="text"&gt;

&lt;script&gt;
function myFunction()
{
var x=document.getElementById("demo").value;
if(x==""||isNaN(x)) /*?*/
    {
    alert("Not Numeric");
    }
}
&lt;/script&gt;

&lt;button type="button" onclick="myFunction()"&gt;Click Me!&lt;/button&gt;

&lt;/body&gt;
&lt;/html&gt; 
</code></pre>

<p>which will give an output like</p>

<p><img src="http://i.stack.imgur.com/VIcHp.png" alt="this"></p>

<p>Here in code we are checking if no value enterd,alert user ,by checking <code>if(x==""||isNaN(x))</code> . But if I enter a space character inside textbox, the check fails. What will be the way to check it?</p>

<p>PS : I am using chrome. And trim() not worked.</p>
