<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Atik Bin Hashmee on Medium]]></title>
        <description><![CDATA[Stories by Atik Bin Hashmee on Medium]]></description>
        <link>https://medium.com/@atikbinhashmee?source=rss-55a135932676------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*FLYXg0sEfZbhXIH5.</url>
            <title>Stories by Atik Bin Hashmee on Medium</title>
            <link>https://medium.com/@atikbinhashmee?source=rss-55a135932676------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 01:46:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@atikbinhashmee/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Javascript Variable and its behavior operations]]></title>
            <link>https://medium.com/@atikbinhashmee/javascript-variable-and-its-behavior-operations-545d39e445de?source=rss-55a135932676------2</link>
            <guid isPermaLink="false">https://medium.com/p/545d39e445de</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[ecmascript-6]]></category>
            <dc:creator><![CDATA[Atik Bin Hashmee]]></dc:creator>
            <pubDate>Tue, 21 May 2019 08:55:33 GMT</pubDate>
            <atom:updated>2019-05-21T08:58:01.914Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z_AM84SQ9nxkk1ZD" /><figcaption>Photo by <a href="https://unsplash.com/@rcrazy?utm_source=medium&amp;utm_medium=referral">Ricardo Rocha</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>JavaScript offers Loosely type variable. that means you don’t need to declare any variable data type such as int, float, double or string. language is smart enough to understand what’s going on with the data.</p><p>Today I am going to show some of the different cases that are used with the variable.</p><p>lets first discuss how many data typed variable is supported in JavaScript.</p><ol><li>Boolean</li><li>Number</li><li>string</li><li>null</li><li>undefined</li><li>symbol //ES6 feature new primitive DataType</li><li>user-defined object (optional) for more <a href="https://codeburst.io/javascript-data-types-explained-347555cd2d4d">click here to learn</a></li></ol><p><strong>Note: you check any type with the keyword typeof in Javascript</strong></p><blockquote>var a = 123;</blockquote><blockquote>console.log(type a); //? number</blockquote><blockquote>var counter = symbol(“counter”);</blockquote><blockquote>console.log(typeof counter) //? symbol</blockquote><p>At first, Understand what is the difference between “null” and “undefined” in JavaScript. the variable is undefined when it&#39;s declared but no value is assigned. yet;</p><p>and the variable is null means it has no reference, it&#39;s set to null. no value; just like we do initialize variable to 0;</p><blockquote>var a; // this variable is declared but no value has been assigned so js automatically set it to undefined</blockquote><blockquote>var a = null; // this variable is initialized with null value;</blockquote><blockquote>// just like we do to calculate sum of any value</blockquote><p>int sum = 0;</p><p>I guess this is pretty much known to everybody, just to remind it the second time.</p><p>the reference:- <a href="https://www.ajaymatharu.com/javascript-difference-between-undefined-and-null/">click here to see the learn more</a></p><p>My understanding from the above the article. why is it automatically set to undefined when nothing is initialized. is because, just like I mentioned at the top, JavaScript is a loosely typed language. it automatically detects the value of a variable and the set variable type to its datatype</p><p>let&#39;s take an example:</p><blockquote>var a = 12; // it cast the variable to the int type</blockquote><blockquote>var str = “hello world”; var str = “123”; // these variable is cast to string type.</blockquote><blockquote>var fract = 12.5; // this variable is cast to double type as there is a decimal point traced in the term</blockquote><blockquote>var tem = null // this is cast to null;</blockquote><blockquote>var isAdmin = true; // this is cast to Boolean type</blockquote><p>// now as you see when you don’t set any data to the variable, javascript engine simply means its an undefined type</p><p>What about Objects?</p><p>okay, first of Objects are not a primitive datatype. above mentioned all the variable is a primitive datatype Primitive</p><p>An object is a collection of properties. These properties are stored in key/value pairs. Properties can reference any type of data, including objects and/or primitive values.</p><p><strong>Now the main part of the article:</strong></p><p>what about operations in JavaScript?</p><p>an expression like</p><blockquote>1+3/1*6–10;</blockquote><p>How does JavaScript handle this type of expression in operation</p><p>well, we know the operator precedence at our school.</p><p>the well-known rules BODMAS</p><p>this simply means <strong>B</strong>rackets, <strong>O</strong>rder, <strong>D</strong>ivision, <strong>M</strong>ultiplication, <strong>A</strong>ddition, <strong>S</strong>ubtraction</p><p>// for example</p><blockquote>1+2–11 //? -8</blockquote><blockquote>// to avoid any confusion you can use bracket</blockquote><blockquote>(1+2)-11// ? -8 same result</blockquote><p>Casting type operations</p><p><strong>Addition:</strong></p><blockquote>1+2+”11&quot; // ? 311</blockquote><blockquote>“1”+2+11 //? 1211</blockquote><blockquote>1+”2&quot;+11 //? 1211</blockquote><p>why is this variation here?</p><p>A key point to remember is that</p><blockquote>if the expression starts with ‘string’ then the whole expression is considered to be the string</blockquote><blockquote>if any middle value is string, also cast the whole expression as a string</blockquote><blockquote>but if the string value has appeared in the end, then its calculate the previous all value and then concatenate the string with the calculated value</blockquote><p>//example</p><blockquote>7+7+”7&quot; //</blockquote><blockquote>7+7=14</blockquote><blockquote>then</blockquote><blockquote>14+”7&quot; = 147</blockquote><p><strong>Subtraction, Multiplication, Division:</strong></p><p>Okay, here is the deal, above variation, is only for “addition”</p><p>let’s see some cases</p><blockquote>“10”/2 //? 5 , 10/”2&quot; //? 5, “10”/”2&quot; //? 5</blockquote><blockquote>“3”*4 //? 12 , 3*”4&quot; //? 12 , “3”*”4&quot; //?12</blockquote><blockquote>6-”3&quot; //? 3, “6”-3 //? 3, “6”-”3&quot;//? 3</blockquote><p>Let’s go for a little complicated expression.</p><p>what will be the output in the below expression</p><blockquote>(100+”10&quot;)*6 //? 60060</blockquote><blockquote>(“100”-10+5) /2 *4 *(“4”+”6&quot; * 4 ) //? 80560</blockquote><blockquote>(“100”+5–10)/2 //? 995</blockquote><p>Thanks for reading this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=545d39e445de" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>