!!expression for boolean
<p>I was reading John Resig's <strong>Secrets of JavaScript Ninja</strong> and saw this code:</p>

<pre><code> function Ninja(){
   this.swung = false;

   // Should return true
   this.swingSword = function(){
     return !!this.swung;
   };
 }
</code></pre>

<p>I know <code>!!</code> is used to convert an expression into boolean. But my question is why does he use:</p>

<pre><code>return !!this.swung;
</code></pre>

<p>Isn't that redundant because <code>swung</code> is already a boolean variable or am I missing something ?</p>

<p>BTW here is full relevant code just in case:</p>

<pre><code> function Ninja(){
   this.swung = false;

   // Should return true
   this.swingSword = function(){
     return !!this.swung;
   };
 }

 // Should return false, but will be overridden
 Ninja.prototype.swingSword = function(){
   return this.swung;
 };

 var ninja = new Ninja();
 assert( ninja.swingSword(), "Calling the instance method, not the prototype method."
)
</code></pre>
