<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>operators &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/operators/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>JavaScript Comparision Snippet</title>
		<link>/2010/03/21/javascript-comparision-snippet/</link>
		<comments>/2010/03/21/javascript-comparision-snippet/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 06:35:23 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[operators]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">/?p=1371</guid>
		<description><![CDATA[== vs. === I know this is really for beginners, but have you ever asked yourself what are the differences between == and === when comparing in JavaScript, and when to use it? Here&#8217;s an example: var a = false; alert(a === 0); // prints false That&#8217;s false. Even when both the zero and the &#8230; <a href="/2010/03/21/javascript-comparision-snippet/" class="more-link">Continue reading <span class="screen-reader-text">JavaScript Comparision Snippet</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2011/10/21/does-javascript-undefined-equals-undefined/" rel="bookmark" title="Does JavaScript undefined Equals undefined?">Does JavaScript undefined Equals undefined? </a></li>
<li><a href="/2009/03/09/flex-javascript-communcation-example/" rel="bookmark" title="Flex Javascript communcation example">Flex Javascript communcation example </a></li>
<li><a href="/2010/02/12/how-to-detect-a-variable-existence-in-javascript/" rel="bookmark" title="How to detect a variable existence in JavaScript?">How to detect a variable existence in JavaScript? </a></li>
<li><a href="/2009/07/08/javascript-closures-in-brief/" rel="bookmark" title="JavaScript closures in brief">JavaScript closures in brief </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>== vs. ===</h2>
<p>I know this is really for beginners, but have you ever asked yourself what are the differences between <strong>==</strong> and <strong>===</strong> when comparing in JavaScript, and when to use it? Here&#8217;s an example:</p>
<pre lang="javascript">var a = false;
alert(a === 0); // prints false</pre>
<p>That&#8217;s false. Even when both the zero and the variable are faulty the entire operation is false. Because the 0 is a number and the variable a is boolean, therefore their different types give us the answer. If there was a comparision only with == the result would be true:</p>
<pre lang="javascript">var a = false;
alert(a == 0); // prints true</pre>
<p>It&#8217;s good when you expect some variable to match certain type to compare with ===. So the correct code is:</p>
<pre lang="javascript">var a = false;
alert(a === false); // prints true</pre>
<p>Here the type of a compares with boolean. See the complete <a href="http://www.stoimen.com/projects/javascript.comparision/" target="_blank">demo</a>.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2011/10/21/does-javascript-undefined-equals-undefined/" rel="bookmark" title="Does JavaScript undefined Equals undefined?">Does JavaScript undefined Equals undefined? </a></li>
<li><a href="/2009/03/09/flex-javascript-communcation-example/" rel="bookmark" title="Flex Javascript communcation example">Flex Javascript communcation example </a></li>
<li><a href="/2010/02/12/how-to-detect-a-variable-existence-in-javascript/" rel="bookmark" title="How to detect a variable existence in JavaScript?">How to detect a variable existence in JavaScript? </a></li>
<li><a href="/2009/07/08/javascript-closures-in-brief/" rel="bookmark" title="JavaScript closures in brief">JavaScript closures in brief </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/03/21/javascript-comparision-snippet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
