How does the typeof method works in Javascript? : <pre><code>if(typeof(variable) === "boolean"){
  // variable is a boolean
}
</code></pre>

<p><strong>Which one of the two code samples below is equivalent to the one above ?</strong></p>

<p>Sample 1</p>

<pre><code>if(variable === true || variable === false){
  // variable is a boolean
}
</code></pre>

<p>Sample 2</p>

<pre><code>if(variable == true || variable == false){
  // variable is a boolean
}
</code></pre>
