<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Js operators]]></title><description><![CDATA[Js operators]]></description><link>https://js-operater.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/69513c252c69301c9681b6f8/0a45da8e-458f-4588-b48d-f3683add313b.png</url><title>Js operators</title><link>https://js-operater.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 04:51:54 GMT</lastBuildDate><atom:link href="https://js-operater.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Understands Js operators
]]></title><description><![CDATA[so before jump to the oerators understand what is exactly an operator is , image you want to add 2 numbers so what operator do you use , (addition ) right !!
the expression - 1 + 2 =3
so here the 1 An]]></description><link>https://js-operater.hashnode.dev/learn-javascript-operators-from-basics</link><guid isPermaLink="true">https://js-operater.hashnode.dev/learn-javascript-operators-from-basics</guid><category><![CDATA[ChaiCode]]></category><category><![CDATA[Chaiaurcode]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[javascript operators]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[javascript-basics]]></category><dc:creator><![CDATA[NITESH SHEDGE]]></dc:creator><pubDate>Wed, 04 Mar 2026 12:45:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69513c252c69301c9681b6f8/ba8eeb89-bd9c-4fb8-a81c-25459704f2b5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>so before jump to the oerators understand what is exactly an operator is , image you want to add 2 numbers so what operator do you use , (addition ) right !!</p>
<p>the expression - 1 + 2 =3</p>
<p>so here the 1 And 2 is operant which is going to change by applying operator.</p>
<p>and the operator is which perform changes. and we get combine output from it.</p>
<h3>lets underStand JS operator</h3>
<p>In js there are multiple operators are presents ,below the list of them:</p>
<ol>
<li><p><strong>Arithmetic Operators (</strong> <code>+ - / *</code><strong>)</strong></p>
</li>
<li><p><strong>Assignment Operators (</strong> <code>=</code>, <code>+=</code>, <code>-=</code>, <code>*=</code>, <code>/=</code>, <code>%=</code>, <code>**=</code>, <code>&amp;=</code>, <code>|=</code>, <code>^=</code>, <code>&amp;&amp;=</code>, <code>||=</code>.<code>??=</code><strong>)</strong></p>
</li>
<li><p><strong>Comparison Operators (</strong> <code>== , != , ===, &lt; , &gt; , &gt;= , &lt;=</code><strong>)</strong></p>
</li>
<li><p><strong>Logical Operators (</strong> <code>&amp;&amp; ,|| ,!</code><strong>)</strong></p>
</li>
<li><p><strong>Ternary (Conditional) Operator (</strong> <code>condition ? expression1 : expression2</code>), acting as a shorthand for an <code>if-else</code>statement. <strong>)</strong></p>
</li>
</ol>
<p>lets UnderStands the above all operators in details-</p>
<h3>Arithmetic <strong>Operators</strong></h3>
<p>Arithmetic operators are used to perform <strong>mathematical calculations</strong>.</p>
<p>➤ <code>+</code> (Addition)</p>
<p>Adds two numbers <strong>or concatenates strings</strong>.</p>
<pre><code class="language-plaintext">10 + 5        // 15

"Hello" + " JS" // "Hello JS"
</code></pre>
<p>➤ <code>-</code> (Subtraction)</p>
<p>Subtracts the right operand from the left.</p>
<pre><code class="language-plaintext">10 - 3 // 7
</code></pre>
<p>➤ <code>*</code> (Multiplication)</p>
<p>Multiplies two numbers.</p>
<pre><code class="language-plaintext">4 * 5 // 20
</code></pre>
<p>➤ <code>/</code> (Division)</p>
<pre><code class="language-plaintext">10 / 4   // 2.5
</code></pre>
<p>⚠️ Division by <code>0</code> returns <code>Infinity</code>.</p>
<p>➤ <code>%</code> (modulo)</p>
<p>this operator gives you an remainder of an division</p>
<pre><code class="language-plaintext">10%2  // 0
</code></pre>
<h3>Assignment Operators</h3>
<p>Assignment operators <strong>assign values to variables</strong> and may also perform calculations.</p>
<p>➤ <code>=</code> (Assignment)</p>
<p>Assigns a value to a variable.</p>
<pre><code class="language-plaintext">let x = 10;
</code></pre>
<p>➤ <code>+=</code></p>
<p>Adds and assigns.</p>
<pre><code class="language-plaintext">let x = 5;
x += 3; // x = 8 
</code></pre>
<p>its a short form of writing</p>
<pre><code class="language-plaintext">x=x+3;
</code></pre>
<h3>➤ <code>-=</code></h3>
<p>Subtracts and assigns.</p>
<pre><code class="language-plaintext">x -= 2; // x = x - 2
</code></pre>
<h3>➤ <code>*=</code></h3>
<p>Multiplies and assigns.</p>
<pre><code class="language-plaintext">x *= 4;
</code></pre>
<h3>➤ <code>/=</code></h3>
<p>Divides and assigns.</p>
<pre><code class="language-plaintext">x /= 2;
</code></pre>
<p>➤ <code>%=</code> (Modulus Assignment)</p>
<p>Stores the remainder.</p>
<pre><code class="language-plaintext">x %= 3;
</code></pre>
<p>➤ <code>**=</code> (Exponent Assignment)</p>
<p>Raises power and assigns.</p>
<pre><code class="language-plaintext">x **= 2; // x = x²
</code></pre>
<p>➤ <code>&amp;&amp;=</code></p>
<p>Assigns value <strong>only if current value is truthy</strong>.</p>
<pre><code class="language-plaintext">
let isLoggedIn = true;
isLoggedIn &amp;&amp;= "User Active";
</code></pre>
<p>➤ <code>||=</code></p>
<pre><code class="language-plaintext">let name = "";
name ||= "Guest";
</code></pre>
<h3>➤ <code>??=</code></h3>
<p>Assigns value <strong>only if variable is</strong> <code>null</code> <strong>or</strong> <code>undefined</code>.</p>
<pre><code class="language-plaintext">let user;
user ??= "Anonymous";
</code></pre>
<p>Safer than <code>||=</code> because it does not treat <code>0</code> or <code>""</code> as falsy.</p>
<h3>Comparison Operators</h3>
<p>Comparison operators <strong>compare two values</strong> and return a boolean (true,false,0, 1).</p>
<p>➤ <code>==</code> (Loose Equality)</p>
<pre><code class="language-plaintext">5 == "5" // true
</code></pre>
<p>➤ <code>===</code> (Strict Equality)</p>
<pre><code class="language-plaintext">5 === "5" // false
</code></pre>
<p>➤ <code>!=</code></p>
<p>Checks inequality with type conversion.</p>
<pre><code class="language-plaintext">5 != "6" // true
</code></pre>
<p>➤ <code>&lt;</code></p>
<p>less than sign checking left value is less than right side then return true otherwise false.</p>
<pre><code class="language-plaintext">2&lt;1 //false
3&lt;4 //true
</code></pre>
<p>➤ <code>&gt;</code></p>
<p>greater than sign checking left value is greater than left side then return true otherwise false.</p>
<pre><code class="language-plaintext">2&gt;1 //true
3&gt;4 //false
</code></pre>
<p>➤ <code>&gt;= , &lt;=</code></p>
<p>less than eqaul to singn check the value including that value , similar greater than eqaul to</p>
<p>checks the value.</p>
<pre><code class="language-plaintext">2&lt;=21 //false
3&lt;4 //true
</code></pre>
<pre><code class="language-plaintext">2&gt;1 //true
3&gt;=3 //true
</code></pre>
<h3>Logical Operators</h3>
<p>Logical operators are used for <strong>decision-making and flow control</strong>. like if we want to execute particular code if both are condition true or on of condition true .</p>
<p>➤ <code>&amp;&amp;</code> (Logical AND)</p>
<p>Returns <code>true</code> if <strong>both conditions are true</strong>.</p>
<pre><code class="language-plaintext">true &amp;&amp; false // false
</code></pre>
<p>➤ <code>||</code> (Logical OR)</p>
<p>Returns <code>true</code> if <strong>any condition is true</strong>.</p>
<pre><code class="language-plaintext">false || true // true
</code></pre>
<p>➤ <code>!</code> (Logical NOT)</p>
<p>Inverts a boolean value. if there is true then its implaise to false.</p>
<pre><code class="language-plaintext">!true // false
</code></pre>
<h3>Ternary (Conditional) Operator</h3>
<p>its an short-hand of if-else condition</p>
<p>syntax -</p>
<pre><code class="language-plaintext">condition ? expression1 : expression2
</code></pre>
<p>Example:</p>
<pre><code class="language-plaintext">let age = 20;
let status = age &gt;= 18 ? "Adult" : "Minor";
</code></pre>
<p>Equivalent to:</p>
<pre><code class="language-plaintext">if (age &gt;= 18) {
  status = "Adult";
} else {
  status = "Minor";
}
</code></pre>
]]></content:encoded></item></channel></rss>