<?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/"
	
xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
>

<channel>
	<title>javascript - Bipon's Diary</title>
	<atom:link href="https://biponnotes.iglyphic.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://biponnotes.iglyphic.com</link>
	<description>Do good for others. It will come back in unexpected ways.</description>
	<lastBuildDate>Thu, 06 Feb 2020 07:21:46 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.9.10</generator>
<site xmlns="com-wordpress:feed-additions:1">168324471</site>	<item>
		<title>The concept of hoisting in JavaScript</title>
		<link>https://biponnotes.iglyphic.com/the-concept-of-hoisting-in-javascript/</link>
					<comments>https://biponnotes.iglyphic.com/the-concept-of-hoisting-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Thu, 06 Feb 2020 07:20:20 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=503</guid>

					<description><![CDATA[<p>Behind the Scenes, you will see that JavaScript always takes all the declarations first. That&#8217;s basically the hosting. Since this is the default behavior in JavaScript. In this article, I will discuss only the hosting specific. Since hosting is the default behavior, all functions in JavaScript are hosted in the Creation phase. That&#8217;s why we can actually call&#8230;<a href="https://biponnotes.iglyphic.com/the-concept-of-hoisting-in-javascript/" class="more-link">Continue reading <span class="screen-reader-text">The concept of hoisting in JavaScript</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/the-concept-of-hoisting-in-javascript/">The concept of hoisting in JavaScript</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Behind the Scenes, you will see that JavaScript always takes all the declarations first. That&#8217;s basically the hosting. Since this is the default behavior in JavaScript.  In this article, I will discuss only the hosting specific. </p>



<p>Since hosting is the default behavior, all functions in JavaScript are hosted in the Creation phase. That&#8217;s why we can actually call a function before declaring it. </p>



<pre class="wp-block-code"><code>customFunc();

 function customFunc(){
     let a = 77;
     let b = 4;
     let sum = a + b;
     console.log('Sum : ' + sum) 
 }</code></pre>



<figure class="wp-block-image"><img width="424" height="199" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/02/5-1.png?resize=424%2C199&#038;ssl=1" alt="" class="wp-image-504" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/5-1.png?w=424&amp;ssl=1 424w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/5-1.png?resize=300%2C141&amp;ssl=1 300w" sizes="(max-width: 424px) 100vw, 424px" data-recalc-dims="1" /></figure>



<p> The reason for working is for JavaScript default behavior in the Creation phase.  Here are some points for convenience: </p>



<ul><li>The arguments list of the arguments that are passed to the function is created</li><li>The code scans all the functions and each function is stored in a variable object that usually points to the function.</li><li>Then it looks for the declarations of the code variables. And <code>undefined</code> sets the property for each declared variable .</li><li></li></ul>



<p>Then the code goes to the execution phase and the line-by-line code is executed according to the execution context.</p>



<p>And that is why since function declaration is earlier in the creation phase and the function call is executed in execution phase, we can use it even before declaring function.</p>



<p>But function expressions will not work this way. Because in function expressions we store our functions in a variable. And that variable <code>undefined</code>is set as the creation phase . The original function is executed later, so calling the function before declare in the function expression will show the error as it is not a function. Because it&#8217;s not really a function right now, just a variable.</p>



<pre class="wp-block-code"><code> miew();

 var miewVar = function(){
     console.log('Miew is calling')
 }</code></pre>



<figure class="wp-block-image"><img loading="lazy" width="506" height="95" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/02/3-1.png?resize=506%2C95&#038;ssl=1" alt="" class="wp-image-505" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/3-1.png?w=506&amp;ssl=1 506w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/3-1.png?resize=300%2C56&amp;ssl=1 300w" sizes="(max-width: 506px) 100vw, 506px" data-recalc-dims="1" /></figure>



<p> Similarly, we can use a variable before declaring it. If you use a variable before declaring it <code>undefined</code> because of the Creation phase, it will not show any error, but it will show that variable <code>undefined</code> as it is set in Creation Phase . </p>



<pre class="wp-block-code"><code>console.log('Value of Miew: ' + miew);
var miew = 10</code></pre>



<figure class="wp-block-image"><img loading="lazy" width="427" height="117" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/02/6.png?resize=427%2C117&#038;ssl=1" alt="" class="wp-image-506" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/6.png?w=427&amp;ssl=1 427w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/6.png?resize=300%2C82&amp;ssl=1 300w" sizes="(max-width: 427px) 100vw, 427px" data-recalc-dims="1" /></figure>



<p>But if you have never declared that variable later, you will want to use it: </p>



<pre class="wp-block-code"><code>console.log('Value of C: ' + miewC);</code></pre>



<figure class="wp-block-image"><img loading="lazy" width="434" height="115" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/02/7-1.png?resize=434%2C115&#038;ssl=1" alt="" class="wp-image-507" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/7-1.png?w=434&amp;ssl=1 434w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/7-1.png?resize=300%2C79&amp;ssl=1 300w" sizes="(max-width: 434px) 100vw, 434px" data-recalc-dims="1" /></figure>



<p>So hopefully this time, there is a clear idea about hosting. However, for good practice it is not advisable to use a function before declaring it. But there&#8217;s definitely a lot of work to be done to understand how JavaScript works within the scene. In some situations, it may be helpful to have such a technique. </p><p>The post <a href="https://biponnotes.iglyphic.com/the-concept-of-hoisting-in-javascript/">The concept of hoisting in JavaScript</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/the-concept-of-hoisting-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">503</post-id>	</item>
		<item>
		<title>Behind the Scene in JavaScript</title>
		<link>https://biponnotes.iglyphic.com/behind-the-scene-in-javascript/</link>
					<comments>https://biponnotes.iglyphic.com/behind-the-scene-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Wed, 05 Feb 2020 17:34:50 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=484</guid>

					<description><![CDATA[<p>If you understand how Code Behind works in the scene, you can write code at your convenience anyway.&#160;In this episode of mine today, I will discuss as much detail as possible about how JavaScript works within the scene. JavaScript is usually run in an environment.&#160;Often it may be our most widely used browser, or another&#8230;<a href="https://biponnotes.iglyphic.com/behind-the-scene-in-javascript/" class="more-link">Continue reading <span class="screen-reader-text">Behind the Scene in JavaScript</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/behind-the-scene-in-javascript/">Behind the Scene in JavaScript</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p> If you understand how Code Behind works in the scene, you can write code at your convenience anyway.&nbsp;In this episode of mine today, I will discuss as much detail as possible about how JavaScript works within the scene. </p>



<p> JavaScript is usually run in an environment.&nbsp;Often it may be our most widely used browser, or another application program such as&nbsp;<a rel="noreferrer noopener" aria-label=" (opens in a new tab)" target="_blank" href="https://nodejs.org/en/">Node JS</a>&nbsp;. </p>



<p> Now from where this JavaScript is run, there is also a JavaScript engine (Google V8 Engine, Spider Monkey, JavaScript Core etc…) whose function is to execute this JavaScript code.&nbsp;Browsers use JavaScript to make JavaScript run.&nbsp;For example, Google Chrome uses Google V8 engine, Firefox uses Spider-Manki / Rihano, Internet Explorer and Edge servers use the engine, and Safari uses JavaScript-core / Nitro (JavaScript has many engines,&nbsp;<a rel="noreferrer noopener" href="https://en.wikipedia.org/wiki/JavaScript_engine#JavaScript_engines" target="_blank">see here for</a>&nbsp;full reference&nbsp;).</p>



<p> Now this JavaScript code executes in several steps and runs. </p>



<pre class="wp-block-code"><code>Code > Parser > Convert to machine code > code runs</code></pre>



<p>Here, the code passes through the parser first.&nbsp;Here the syntax error is usually checked.&nbsp;If a syntax error is found, then the error is thrown from here.&nbsp;And if all the syntax is done, then a data structure called Abstract Syntax Tree is created.</p>



<p>The next step is to convert this code into machine code, which our computer can actually understand.&nbsp;And finally our code is run.</p>



<p>Now why do you have to cross such steps before running a code?&nbsp;Yes, our computer does not understand anything but the machine code.&nbsp;Whatever language we write in code, it must be converted to machine code, or our computer may not understand it.</p>



<h2 id="9040">Execution Context and Execution Stack</h2>



<p>It is very important to have clear ideas about Execution Context and Execution Stack.&nbsp;There are many trick issues in JavaScript that are difficult to understand unless you can understand exactly the Execution Context and the Execution Stack.</p>



<p><strong>Execution Context:</strong></p>



<p>By default Javascript executes global context.&nbsp;Unlike some other languages, no space functions are executed.&nbsp;And JavaScript&#8217;s Global Execution Context is a browser&nbsp;<code>window</code>object.&nbsp;Declaring a global variable or assigning it to an&nbsp;<code>window</code>object is the same</p>



<pre class="wp-block-code"><code>let bGlobal = 77;</code></pre>



<p>Now I can see if it is <code>window </code>inside:<code>bGlobal </code></p>



<p>window.<code>bGlobal </code> </p>



<p> Then you see that this seam&nbsp;<code>bGlobal</code>shows the value of&nbsp;your declared </p>



<figure class="wp-block-image"><img loading="lazy" width="428" height="140" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/02/1.png?resize=428%2C140&#038;ssl=1" alt="" class="wp-image-485" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/1.png?w=428&amp;ssl=1 428w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/1.png?resize=300%2C98&amp;ssl=1 300w" sizes="(max-width: 428px) 100vw, 428px" data-recalc-dims="1" /></figure>



<pre class="wp-block-code"><code>bGlobal === window.bGlobal //true</code></pre>



<figure class="wp-block-image"><img loading="lazy" width="422" height="174" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/02/2-1.png?resize=422%2C174&#038;ssl=1" alt="" class="wp-image-490" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/2-1.png?w=422&amp;ssl=1 422w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/2-1.png?resize=300%2C124&amp;ssl=1 300w" sizes="(max-width: 422px) 100vw, 422px" data-recalc-dims="1" /></figure>



<p>That means two things are the same.&nbsp;So&nbsp;<code>window</code>it is the same thing to&nbsp;declare a global variable or assign it to an&nbsp;object.</p>



<p>However, if your environment is not a browser, then this Global Execution Context may be different depending on the environment.&nbsp;For example, Node JS&#8217;s Global Execution Context is an&nbsp;<code>global</code>object.&nbsp;Depending on the environment it may change.</p>



<p>Execution context is discussed in more detail later.</p>



<p><strong>Execution Stack:</strong></p>



<p>We&#8217;ll use an example to get a clear idea about Execution Stack in JavaScript and see how those codes are executed.</p>



<pre class="wp-block-code"><code>function A(){
    let a = ' call from a';
    B();
    console.log('Hey', name + a);
}
function B(){
    let b = ' call from b';
    C();
    console.log('Hey', name +  b)
}
function C(){
    let c = ' call from c';
    console.log('Hey', name + c)
}
A();</code></pre>



<p> If you run this code above, you will see how it runs: </p>



<figure class="wp-block-image"><img loading="lazy" width="429" height="129" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/02/3.png?resize=429%2C129&#038;ssl=1" alt="" class="wp-image-489" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/3.png?w=429&amp;ssl=1 429w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/3.png?resize=300%2C90&amp;ssl=1 300w" sizes="(max-width: 429px) 100vw, 429px" data-recalc-dims="1" /></figure>



<p>The last ones are coming before and the first ones are later.&nbsp;How does it look random?&nbsp;Yes here we need to understand how the execution stack works.&nbsp;So only then will we have a clear idea of ​​how this code ran.&nbsp;First notice this diagram below: </p>



<figure class="wp-block-image"><img loading="lazy" width="720" height="386" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/02/5.png?resize=720%2C386&#038;ssl=1" alt="" class="wp-image-491" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/5.png?w=720&amp;ssl=1 720w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/5.png?resize=300%2C161&amp;ssl=1 300w" sizes="(max-width: 720px) 100vw, 720px" data-recalc-dims="1" /></figure>



<p>Here the number codes will be executed according to the serial number.&nbsp;And the diagram on the right is the Basically Execution Stack.&nbsp;If you have no idea about the stack data structure, then the stack is a structure where the first in-out system is maintained.&nbsp;This means that there will be only one way to get data out, and whenever a data is extracted it can be extracted from the top.&nbsp;If you have several glass plates stacked on top of one, then if you want to take a plate, you have to take the top plate first, otherwise you will not be able to take it down or you will still have an accident.&nbsp;The plate that you place at the end of the stack should be taken if you want to take a plate on the data structure system, since this plate is on top of you.&nbsp;And the plate you put first will be the bottom,</p>



<p>Now when our code is number 1 it is&nbsp;assigned to the&nbsp;<code>name</code>variable&nbsp;<code>Bipon</code>.&nbsp;Then only the function definitions go one by one&nbsp;<code>A()</code>, then&nbsp;<code>B()</code>and finally into the&nbsp;<code>C()</code>execution stack on the global execution context.&nbsp;Nothing will be excluded from inside the function as we have not called any of the functions yet.</p>



<p>Then we&nbsp;<code>A()</code>call the function&nbsp;at number 5&nbsp;.&nbsp;It will now be positioned on the global execution context in the first execution stack and will now&nbsp;<code>A()</code>start executing the code from within.&nbsp;Now with a variable at number 1, some data is assigned there.&nbsp;But again another function&nbsp;<code>B()</code>is called&nbsp;at number 5&nbsp;.&nbsp;So now Execution Stack A&nbsp;<code>A()</code>will have another new execution context&nbsp;<code>B()</code>on it and now&nbsp;<code>B()</code>the code will start&nbsp;executing&nbsp;from within.&nbsp;Now here also some data has been assigned to a new variable in number 1.&nbsp;Again another function called number 7&nbsp;<code>C()</code>is called.&nbsp;So now another execution context&nbsp;<code>C()</code>will be found in the&nbsp;execution stack&nbsp;and now&nbsp;<code>C()</code>the code will start executing from within.&nbsp;Now <code>C()</code>Inside number 1 again, some new data is assigned with a new variable.&nbsp;And the console is logged in the next line which will now show on your console.&nbsp;So the log here is the first thing you see in your output.&nbsp;Now&nbsp;<code>C()</code>execute is over and it will move away.&nbsp;So now the execution context will go&nbsp;<code>B()</code>as it is now at the top of the execution stack.&nbsp;Now&nbsp;<code>B()</code>inside the console log of the number 12 will be printed on the output and so you will see this as the output in the second position.&nbsp;Now the same way&nbsp;<code>B()</code>, the last one and the execution stack will be gone.&nbsp;Now the execution stack will be at the top&nbsp;<code>A()</code>.&nbsp;So now&nbsp;<code>A()</code>it will be executed.<code>A()</code>Console logs located at number 5 will be printed at the output and this function will be finished and removed from the execution stack.&nbsp;And so you can see the output here.&nbsp;This is how the execution stack works in JavaScript.&nbsp;And so we see output like this.</p>



<p><strong>Details on Execution Context:</strong></p>



<p>It is very important to know the details of the execution context.&nbsp;You may have seen in JavaScript that you can call before you define a function and that code will work perfectly.</p>



<pre class="wp-block-code"><code>miew();
function miew() {
 console.log('Miew');
}</code></pre>



<p>This code will work fine if you run it all together.</p>



<p>Or you can use a variable before defining it (before defining it will show the value undefined, no error).</p>



<pre class="wp-block-code"><code>console.log(miew);
var miew = 'Hello World!';</code></pre>



<p>Output will come like this but no error will come </p>



<p><code>undefined</code></p>



<figure class="wp-block-image"><img loading="lazy" width="381" height="46" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/02/7.png?resize=381%2C46&#038;ssl=1" alt="" class="wp-image-492" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/7.png?w=381&amp;ssl=1 381w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/02/7.png?resize=300%2C36&amp;ssl=1 300w" sizes="(max-width: 381px) 100vw, 381px" data-recalc-dims="1" /></figure>



<p>What causes it?&nbsp;Yes, that&#8217;s why we need to have a more in-depth knowledge of execution context so you can understand why it works.</p>



<p>When a function is called, there are two stages:</p>



<p>2.&nbsp;Creation phase</p>



<p>2.&nbsp;Execution Phase</p>



<p><strong>2.&nbsp;Creation Phase: In</strong>&nbsp;Creation Phase, the variable object is created first.&nbsp;Then the scope chain is created.</p>



<p>What happens in the creation phase directly in Bengal:</p>



<ul><li>The arguments list of the arguments that are passed to the function is created</li><li>The code scans all the functions and each function is stored in a variable object that usually points to the function.</li><li>Then it looks for the declarations of the code variables.&nbsp;And&nbsp;<code>undefined</code>sets the property for&nbsp;each declared variable&nbsp;.</li></ul>



<p><strong>2.&nbsp;Execution Phase:</strong>&nbsp;Then the code is executed in this phase.&nbsp;In the case of code execution, the code execution is executed by executing the context.&nbsp;This is why calling a function before defining it works fine.&nbsp;If you use any other variable before declaring it&nbsp;<code>undefined</code> is set as a&nbsp;value&nbsp;and no error shows.</p>



<p>Reference Source : <a href="https://codeburst.io/js-essentials-the-javascript-engine-302ff38e8465">JS Essentials: The JavaScript Engine</a> , <a href="https://codeburst.io/@misaogura">Execution Context</a> , <a href="https://medium.com/better-programming/understanding-the-this-keyword-in-javascript-cb76d4c7c5e8">Understanding the “this” Keyword in JavaScript</a> , <a href="https://medium.com/%E0%A6%AA%E0%A7%8D%E0%A6%B0%E0%A7%8B%E0%A6%97%E0%A7%8D%E0%A6%B0%E0%A6%BE%E0%A6%AE%E0%A6%BF%E0%A6%82-%E0%A6%AA%E0%A6%BE%E0%A6%A4%E0%A6%BE/%E0%A6%9C%E0%A6%BE%E0%A6%AD%E0%A6%BE%E0%A6%B8%E0%A7%8D%E0%A6%95%E0%A7%8D%E0%A6%B0%E0%A6%BF%E0%A6%AA%E0%A7%8D%E0%A6%9F%E0%A6%83-%E0%A6%AC%E0%A6%BF%E0%A6%B9%E0%A7%8D%E0%A6%AF%E0%A6%BE%E0%A6%87%E0%A6%A8%E0%A7%8D%E0%A6%A1-%E0%A6%A6%E0%A7%8D%E0%A6%AF%E0%A6%BE-%E0%A6%B8%E0%A7%80%E0%A6%A8-4857f19f4059">Behind the Scene</a></p><p>The post <a href="https://biponnotes.iglyphic.com/behind-the-scene-in-javascript/">Behind the Scene in JavaScript</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/behind-the-scene-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">484</post-id>	</item>
		<item>
		<title>JavaScript: async and await</title>
		<link>https://biponnotes.iglyphic.com/javascript-async-and-await/</link>
					<comments>https://biponnotes.iglyphic.com/javascript-async-and-await/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Tue, 28 Jan 2020 10:02:27 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[async]]></category>
		<category><![CDATA[await]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=469</guid>

					<description><![CDATA[<p>If the arrow function is: This is how you can identify asynchronous code in your function. This time you have to identify the original asynchronous codes one by one and tell Javascript that this is my promise that it cannot go to the next instruction until it is solved. Before that we will need a promiss, right? Yes,&#8230;<a href="https://biponnotes.iglyphic.com/javascript-async-and-await/" class="more-link">Continue reading <span class="screen-reader-text">JavaScript: async and await</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/javascript-async-and-await/">JavaScript: async and await</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code>async function customAsyncCode() {
   // Asynchronous Codes
}  </code></pre>



<p> If the arrow function is: </p>



<pre class="wp-block-code"><code> const customAsyncCode = async() => {      
     // Asynchronous Codes    
} </code></pre>



<p> This is how you can identify asynchronous code in your function. This time you have to identify the original asynchronous codes one by one and tell Javascript that this is my promise that it cannot go to the next instruction until it is solved. Before that we will need a promiss, right? Yes, let me start with a promise: </p>



<pre class="wp-block-code"><code>      const a1 = new Promise((resolve, reject) => {
        setTimeout(() => {
          if(true){
            resolve('a 1 resolved');
          }else{
            reject('a 1 error');
          }
        }, 3000)
      })</code></pre>



<p> Now we will handle this promise inside an asynchronous function. That is why I will call our Promise talk inside with an asynchronous identifying function. Now this is where we <code>await</code>need the keyword. With this we will identify our Promise so that this Promise does not go to the next instruction until completed: </p>



<pre class="wp-block-code"><code>const promiseHandle = async() => {
        const data = await a1;
        console.log(data);
      }
      promiseHandle();</code></pre>



<p> Notice here that I just printed the data from our premise in the next line. Yes, here <code>async</code>is <code>await</code>the magic of it. It helps our asynchronous code behave asynchronously so that we no longer have to call the callback. We can retrieve data with a single line-by-line instruction. Now if you call this function you will see our desired data: </p>



<pre class="wp-block-code"><code>promiseHandle()</code></pre>



<p> Now you will see that your console is printed on the next line of console log. If you have trouble understanding it, then <code>setTimeout()</code>you can extend the time and test it yourself by working code synchronously: </p>



<figure class="wp-block-image"><img loading="lazy" width="486" height="182" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/1-5.png?resize=486%2C182&#038;ssl=1" alt="" class="wp-image-470" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/1-5.png?w=486&amp;ssl=1 486w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/1-5.png?resize=300%2C112&amp;ssl=1 300w" sizes="(max-width: 486px) 100vw, 486px" data-recalc-dims="1" /></figure>



<p> Now if the promise is rejected? Yes then <code>try…catch</code>we can handle this rejection or error with our previous block. Before that, our promise to create another such thing: </p>



<pre class="wp-block-code"><code>      const a1Rejection = new Promise((resolve, reject) => {
        setTimeout(() => {
          if(true){
            reject('a 1 error');
          }else{
            resolve('a 1 resolved');
          }
        }, 3000)
      })</code></pre>



<p> Now we <code>async await</code>will create our function. But before we can take data from this promise, we have to <code>try…catch</code>put the whole thing inside the block. And with that <code>catch</code>block we can access our error message: </p>



<pre class="wp-block-code"><code>     const promiseErrorHandle = async() => {
        try{
          const data = await a1Rejection;
          console.log(data);
        }catch(err){
          console.log(err);
        }
      }
</code></pre>



<pre class="wp-block-code"><code>promiseErrorHandle();</code></pre>



<p><strong>An alternative method to handle more than one promise</strong> , now we want to promise more than they can handle  synchronously. Suppose we have two promise: </p>



<pre class="wp-block-code"><code>   const a1 = new Promise((resolve, reject) => {
        setTimeout(() => {
          if(true){
            resolve('a 1 resolved');
          }else{
            reject('a 1 error');
          }
        }, 3000)
      })</code></pre>



<p>

Another one

</p>



<pre class="wp-block-code"><code>     const a2 = new Promise((resolve, reject) => {
        setTimeout(() => {
            if(true) {
              resolve('a 2 Resolved');
            } else {
              reject('a 2 Error');
            }
        }, 3000)
      })</code></pre>



<p> Now here&#8217;s something to understand. If we <code>Promise.all</code>use it, let&#8217;s see if it returns: </p>



<pre class="wp-block-code"><code>console.log('Return all Promise :', Promise.all([a1, a2]))</code></pre>



<p> That means the promise also returns: </p>



<figure class="wp-block-image"><img loading="lazy" width="571" height="146" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/2-2.png?resize=571%2C146&#038;ssl=1" alt="" class="wp-image-471" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/2-2.png?w=571&amp;ssl=1 571w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/2-2.png?resize=300%2C77&amp;ssl=1 300w" sizes="(max-width: 571px) 100vw, 571px" data-recalc-dims="1" /></figure>



<p> So with that we can easily handle multiple promises like this: </p>



<pre class="wp-block-code"><code> const handleMultiplePromise = async() => {
        const data = await Promise.all([a1, a2]);
        console.log(data);
}</code></pre>



<p> Well then how come their data? Yes the data will come in the same array size as we have seen before. Now call the function: </p>



<pre class="wp-block-code"><code>handleMultiplePromise();
</code></pre>



<figure class="wp-block-image"><img loading="lazy" width="568" height="182" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/3-3.png?resize=568%2C182&#038;ssl=1" alt="" class="wp-image-472" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/3-3.png?w=568&amp;ssl=1 568w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/3-3.png?resize=300%2C96&amp;ssl=1 300w" sizes="(max-width: 568px) 100vw, 568px" data-recalc-dims="1" /></figure><p>The post <a href="https://biponnotes.iglyphic.com/javascript-async-and-await/">JavaScript: async and await</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/javascript-async-and-await/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">469</post-id>	</item>
		<item>
		<title>Promise in JavaScript</title>
		<link>https://biponnotes.iglyphic.com/promise-in-javascript/</link>
					<comments>https://biponnotes.iglyphic.com/promise-in-javascript/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Mon, 27 Jan 2020 18:10:29 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[front-end-development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[promise]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=464</guid>

					<description><![CDATA[<p>Creating a Promise: The task of the Promise is to handle such asynchronous operations. Now we are running the operation on a remote server, but until data arrives we cannot say that operation will not succeed or fail. And basically, the promise works to handle these. In most cases, we do not have to create our own promises. We&#8230;<a href="https://biponnotes.iglyphic.com/promise-in-javascript/" class="more-link">Continue reading <span class="screen-reader-text">Promise in JavaScript</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/promise-in-javascript/">Promise in JavaScript</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>Creating a <code>Promise</code>:</strong></p>



<p> The task of the <code>Promise </code>is to handle such <code>asynchronous operations</code>. Now we are running the operation on a remote server, but until data arrives we cannot say that operation will not succeed or fail. And basically, the promise works to handle these. In most cases, we do not have to create our own promises. We handle Just Promise. The basic structure of the promise is that the library we work with will be implemented from the system. We have to handle just Promise. But I&#8217;ll also look at how we can create our own promise here. </p>



<pre class="wp-block-code"><code>    let bb = new Promise((resolve, reject) => {
      let a = 1 + 1;
      if(a == 2){
        resolve('Success man!')
      }else{
        reject('Faild man!')
      }
    })

    bb.then((message) => {
      console.log('Get', message)
    }).catch((message) =>{
      console.log('Get', message)
    })</code></pre>



<p> Promise takes two arguments, <code>resolve</code>and <code>reject</code>. </p>



<p><strong>Handle Promise:</strong></p>



<p> Now we will handle whether the Promise has succeeded or failed. In that case, if the Promise is successful then we can chain our <code>bb</code> function and <code>.then()</code>give a callback function here, which <code>resolve</code>will run if the Promise is successful or otherwise: </p>



<pre class="wp-block-code"><code>    bb.then((message) => {
      console.log('Get', message)
    }).catch((message) =>{
      console.log('Get', message)
    })</code></pre>



<p><a href="https://bipon.me/callback-function/">Callback</a></p>



<p> After that <code>true</code>argument <code>resolve</code>, our callback will be triggered by the promise : </p>



<pre class="wp-block-code"><code>  bb.then((message) => {
      console.log('Get', message)
    })</code></pre>



<p> And if the promise is rejected, then we need <code>.catch()</code>to handle it in another chain operation with a callback function. Now we do not know whether the operation will succeed or fail. In that case, we <code>.then()</code>have to <code>.catch()</code>keep both. <code>.catch()</code>If for any reason we will run <code>reject</code>: </p>



<pre class="wp-block-code"><code>.catch((message) =>{
      console.log('Get', message)
    })</code></pre>



<p> The arguments <code>false</code>given here <code>reject</code>will be from the promise . And so  <code>catch</code>the callback will run inside the block after the operation is finished :</p>



<pre class="wp-block-code"><code>  let bb = new Promise((resolve, reject) => {
      let a = 1 + 2;
      if(a == 2){
        resolve('Success man!')
      }else{
        reject('Faild man!')
      }
    })

    bb.then((message) => {
      console.log('Get', message)
    }).catch((message) =>{
      console.log('Get', message)
    })</code></pre>



<p>The <code>bb</code>function that we first returned the Promise here, the creation of the Promise, in most cases, does not require us to write. Rather, the system we use to exchange data, or use the library, is coded as a part of how to do <code>resolve</code>or not do <code>reject</code>it. In most cases, the promise of our return <code>.then()</code>, and <code>.catch()</code>with the handle. The callbacks that are used inside, in most cases, the data we want from our remote server comes as arguments. We can access those arguments from within a callback. </p>



<p><strong>Handling</strong> Multiple Promises: At times, we may have to handle multiple promos. For example, we have two premises: </p>



<pre class="wp-block-code"><code>      const a1 = new Promise((resolve, reject) => {
        setTimeout(() => {
          if(true){
            resolve('a 1 resolved');
          }else{
            reject('a 1 error');
          }
        }, 3000)
      })</code></pre>



<p> We can also directly create promises like this. Below I made another Promise: </p>



<pre class="wp-block-code"><code>      const a2 = new Promise((resolve, reject) => {
        setTimeout(() => {
            if(true) {
              resolve('a 2 Resolved');
            } else {
              reject('a 2 Error');
            }
        }, 3000)
      })</code></pre>



<p>

Then&nbsp;<code>.then()</code>I can make a callback call which will run soon after these two promises are completed.&nbsp;And the data from these promos will be arrayed in this callback function:

</p>



<pre class="wp-block-code"><code>Promise.all([a1, a2]).then((promiseArr) => {console.log(promiseArr)}) </code></pre><p>The post <a href="https://biponnotes.iglyphic.com/promise-in-javascript/">Promise in JavaScript</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/promise-in-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">464</post-id>	</item>
		<item>
		<title>জাভাস্ক্রিপ্ট &#8211; var, let, const</title>
		<link>https://biponnotes.iglyphic.com/javascript-var-let-const/</link>
					<comments>https://biponnotes.iglyphic.com/javascript-var-let-const/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Mon, 20 Jan 2020 08:28:07 +0000</pubDate>
				<category><![CDATA[ওয়েব ডেভেলপমেন্ট]]></category>
		<category><![CDATA[ফ্রন্ট এন্ড ডেভেলপমেন্ট]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=403</guid>

					<description><![CDATA[<p>ES6 পড়ুন (এটি ECMAScript 2015 নামেও পরিচিত) জাভাস্ক্রিপ্টের সিনট্যাক্সের চেয়ে বড় পরিবর্তন হয়েছে এবং জেএসে নতুন বৈশিষ্ট্য নিয়ে আঁচছে যা এর আগে ছিল না… ES6 শিখতে গুরুত্বপূর্ণ কারণ এর একটি কারণ হ&#8217;ল এটি জাভাস্ক্রিপ্টকে আরও ভাল লেখা এবং সহজ করে তোলে এবং একই সাথে আজকের আধুনিক ওয়েব প্রযুক্তির সাথে&#160;রিঅ্যাক্ট, নোড.জেস&#160;এবং&#160;আরও অনেকগুলি ব্যবহার করা হচ্ছে&#160;। এই&#8230;<a href="https://biponnotes.iglyphic.com/javascript-var-let-const/" class="more-link">Continue reading <span class="screen-reader-text">জাভাস্ক্রিপ্ট &#8211; var, let, const</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/javascript-var-let-const/">জাভাস্ক্রিপ্ট – var, let, const</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p> ES6 পড়ুন (এটি ECMAScript 2015 নামেও পরিচিত) জাভাস্ক্রিপ্টের সিনট্যাক্সের চেয়ে বড় পরিবর্তন হয়েছে এবং জেএসে নতুন বৈশিষ্ট্য নিয়ে  আঁচছে যা এর আগে ছিল না… </p>



<p>ES6 শিখতে গুরুত্বপূর্ণ কারণ এর একটি কারণ হ&#8217;ল এটি জাভাস্ক্রিপ্টকে আরও ভাল লেখা এবং সহজ করে তোলে এবং একই সাথে আজকের আধুনিক ওয়েব প্রযুক্তির সাথে&nbsp;<strong>রিঅ্যাক্ট, নোড.জেস</strong>&nbsp;এবং&nbsp;আরও অনেকগুলি ব্যবহার করা হচ্ছে&nbsp;।</p>



<p>এই পোস্টে, আপনি নতুন কীওয়ার্ড শিখতে পারবেন যা ES6&nbsp; <strong>ভ্যারিয়েবল ডিক্লারেশন্স</strong>  &nbsp;জন্য নিয়ে আঁচছে:&nbsp;<code>let</code>এবং&nbsp;<code>const</code>।&nbsp;তবে প্রথমে, আসুন কী কী ভুল ছিল তা ব্যাখ্যা করি&nbsp;<code>var</code>।</p>



<h1 id="afe9"> var সমস্যা কি ছিল?</h1>



<p><code>var</code>ভেরিয়েবল ঘোষণার জন্য&nbsp;আমাদের কাছে ইতিমধ্যে&nbsp;জেএসে কীওয়ার্ড&nbsp;ছিল&nbsp;।&nbsp;তাহলে কেন ES6 অতিরিক্ত কীওয়ার্ড চালু করেছে?</p>



<p>সমস্যাটি বোঝার জন্য&nbsp;<code>var</code>প্রথমে আপনাকে বুঝতে হবে যে <a href="https://www.w3schools.com/js/js_scope.asp?source=post_page">scope</a>&nbsp;কী।</p>



<p> <code>Scope determines the accessibility of variables, objects, and functions from different parts of the code</code>. —&nbsp;<strong>w3schools</strong></p>



<p>জাভাস্ক্রিপ্টে 3 ধরণের স্কোপ (Scope) রয়েছে:</p>



<ul><li>ফাংশন (লোকাল ) সুযোগ</li><li>গ্লোবাল স্কোপ  (Scope) </li><li>ব্লক স্কোপ  (Scope)  (ইএস 6 সহ নতুন)</li></ul>



<p><code><strong>var</strong></code><strong>&nbsp;<code>supports function &amp; global scope, but not block scope.</code></strong></p>



<h2 id="c484">ফাংশন ( লোকাল  )  স্কোপ   </h2>



<p>যখন কোনও&nbsp;<strong>ফাংশনের</strong>&nbsp;অভ্যন্তরে কোনও ভেরিয়েবল সংজ্ঞায়িত করা&nbsp;<strong>হয়</strong>&nbsp;, এটি&nbsp;কেবলমাত্র সেই ফাংশনের জন্য&nbsp;<strong>লোকাল  </strong>হবে&nbsp;এবং বাইরে ব্যবহার করা যাবে না:</p>



<pre class="wp-block-code"><code>function local() {
  var number = 1;
   console.log(number); // 1 gets printed
}
console.log(number); // undefined</code></pre>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img loading="lazy" width="716" height="108" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-20.46.26.png?resize=716%2C108&#038;ssl=1" alt="" data-id="404" data-link="https://bipon.me/?attachment_id=404" class="wp-image-404" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-20.46.26.png?w=716&amp;ssl=1 716w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-20.46.26.png?resize=300%2C45&amp;ssl=1 300w" sizes="(max-width: 716px) 100vw, 716px" data-recalc-dims="1" /></figure></li></ul>



<h2 id="9e60">গ্লোবাল স্কোপ</h2>



<p>যখন কোনও ফাংশনের বাইরে কোনও ভেরিয়েবল ঘোষণা করা হয় বা&nbsp;<code>var</code>কীওয়ার্ড&nbsp;ছাড়াই&nbsp;তখন তা&nbsp;<strong>গ্লোবাল</strong>&nbsp;হয়ে&nbsp;যাবে এবং যে কোনও জায়গা থেকে অ্যাক্সেসযোগ্য হবে:</p>



<pre class="wp-block-code"><code>var number = 1;

function local() {  
  console.log(number); // 1 gets printed
}

console.log(number); // 1 gets printed</code></pre>



<h2 id="1b1f">ব্লক স্কোপ</h2>



<p><strong>curly braces { }, if-else cases</strong>&nbsp;এবং <strong>for loops</strong>&nbsp;হয়&nbsp;<strong>block-scoped</strong></p>



<p> আসুন&nbsp;<strong>লুপের ভিতরে</strong>&nbsp;একটি ভেরিয়েবল (সহ&nbsp;<code>var</code>)&nbsp;সংজ্ঞায়িত করি&nbsp;এবং দেখুন কী  প্রিন্ট হয়… </p>



<pre class="wp-block-code"><code>for(var i = 1; i &lt; 10; i++) {
 console.log(i);
} 
console.log(i);    // What do we expect here?</code></pre>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img loading="lazy" width="464" height="438" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/1_3Ol4GcpXx1HmdveODHKlCA.png?resize=464%2C438&#038;ssl=1" alt="" data-id="405" data-link="https://bipon.me/?attachment_id=405" class="wp-image-405" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/1_3Ol4GcpXx1HmdveODHKlCA.png?w=464&amp;ssl=1 464w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/1_3Ol4GcpXx1HmdveODHKlCA.png?resize=300%2C283&amp;ssl=1 300w" sizes="(max-width: 464px) 100vw, 464px" data-recalc-dims="1" /></figure></li></ul>



<p> এখানে সবকিছু ঠিক আছে মনে হচ্ছে।&nbsp;তবে দ্বিতীয়&nbsp;<strong>কনসোল.লগের কী হবে?</strong></p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img loading="lazy" width="300" height="96" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/01/1_mw_ut_4f46jziMo0LXTZfw-1.png?resize=300%2C96&#038;ssl=1" alt="" data-id="407" data-link="https://bipon.me/?attachment_id=407" class="wp-image-407" data-recalc-dims="1"/></figure></li></ul>



<p> দ্বিতীয়&nbsp;<strong>console.log</strong>&nbsp;বাইরে&nbsp;<strong>জন্য</strong>&nbsp;লুপ এবং&nbsp; লোকাল ভ্যারিয়েবল<br><strong> &#8220;i&#8221;</strong>&nbsp;যেহেতু  প্রিন্ট হওয়ার কথা ছিল&nbsp;<strong>undefined</strong>&nbsp;। </p>



<p> তবে, যদি আমরা&nbsp; <strong>let or const,</strong> &nbsp;ব্যবহার&nbsp;<strong>করি, যেহেতু সেগুলি ব্লক-স্কোপড</strong>&nbsp;, এই সমস্যাটি সমাধান হবে। </p>



<p> <strong>রেডিক্লারেশন ইসু অফ var</strong></p>



<p> এর সাথে আর একটি সমস্যা&nbsp;<code>var</code>হ&#8217;ল&nbsp;এটি একই পরিবর্তনশীলগুলিকে বারবার পুনরায়&nbsp;ডিক্লেয়ার করার অনুমতি দেয়&nbsp;: </p>



<pre class="wp-block-code"><code>var number = 1;   // first declaration
var number = 2;   // same variable redeclared with the same name

console.log(number); // And we see no errors</code></pre>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img loading="lazy" width="360" height="80" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-23-22.28.21.png?resize=360%2C80&#038;ssl=1" alt="" data-id="408" data-link="https://bipon.me/?attachment_id=408" class="wp-image-408" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-23-22.28.21.png?w=360&amp;ssl=1 360w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-23-22.28.21.png?resize=300%2C67&amp;ssl=1 300w" sizes="(max-width: 360px) 100vw, 360px" data-recalc-dims="1" /></figure></li></ul>



<p> এখন আসুন দেখুন ES6 কীভাবে তাদের সাথে ডিল করে &#8230; </p>



<p><strong>var এর পরিবর্তে  let </strong></p>



<p> আমি উপরে উল্লিখিত সমস্যাগুলি প্রতিরোধ করতে আসুন এর সাথে আবার চেষ্টা করুন&nbsp;<code>let</code>: </p>



<pre class="wp-block-code"><code>for(let i = 0; i &lt; 10; i++) {   // same local variable with let 
  console.log(i);
}

console.log(i); // This time what do we expect?</code></pre>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img loading="lazy" width="648" height="108" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.45.17.png?resize=648%2C108&#038;ssl=1" alt="" data-id="409" data-link="https://bipon.me/?attachment_id=409" class="wp-image-409" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.45.17.png?w=648&amp;ssl=1 648w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.45.17.png?resize=300%2C50&amp;ssl=1 300w" sizes="(max-width: 648px) 100vw, 648px" data-recalc-dims="1" /></figure></li></ul>



<p>তাই&nbsp;<code>let</code> ব্লক-স্কোপ  ও দ্বিতীয়&nbsp;<strong>console.log</strong>&nbsp;প্রিন্ট করছে <strong>undefined</strong>&nbsp;।&nbsp;পারফেক্ট!</p>



<p>এছাড়াও,&nbsp;একটি ভেরিয়েবলের সাথে একটি ভেরিয়েবল পুনরায়&nbsp;<strong>ঘোষণার</strong>&nbsp;চেষ্টা করে&nbsp;<code>let</code>একটি ত্রুটি প্রদান করে:</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img loading="lazy" width="732" height="140" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.47.08.png?resize=732%2C140&#038;ssl=1" alt="" data-id="410" data-link="https://bipon.me/?attachment_id=410" class="wp-image-410" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.47.08.png?w=732&amp;ssl=1 732w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.47.08.png?resize=300%2C57&amp;ssl=1 300w" sizes="(max-width: 732px) 100vw, 732px" data-recalc-dims="1" /></figure></li></ul>



<p> সুতরাং&nbsp;<code>let</code>কীওয়ার্ড: </p>



<ul><li>can be used instead of&nbsp;<code>var</code></li><li>is&nbsp;<strong>block-scoped</strong></li><li>doesn’t allow&nbsp;<strong>redeclaration</strong>, but can be&nbsp;<strong>reassigned</strong>&nbsp;later</li></ul>



<h1 id="1fd1">const</h1>



<p>অন্য নতুন কীওয়ার্ড যা ES6 এনেছে তা হ&#8217;ল&nbsp;<code>const</code>।</p>



<p><code>let</code>এবং এর&nbsp;মধ্যে পার্থক্য&nbsp;<code>const</code>হ&#8217;ল একবার আমরা এর সাথে একটি ভেরিয়েবল ঘোষণা করি&nbsp;<code>const</code>, পরে এটি পরিবর্তন করা যায় না: </p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img loading="lazy" width="638" height="168" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.53.39.png?resize=638%2C168&#038;ssl=1" alt="" data-id="411" data-link="https://bipon.me/?attachment_id=411" class="wp-image-411" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.53.39.png?w=638&amp;ssl=1 638w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/Ekran-Resmi-2019-07-24-22.53.39.png?resize=300%2C79&amp;ssl=1 300w" sizes="(max-width: 638px) 100vw, 638px" data-recalc-dims="1" /></figure></li></ul>



<p>

মূল&nbsp;<code>const</code>শব্দটি:

</p>



<p></p><p>The post <a href="https://biponnotes.iglyphic.com/javascript-var-let-const/">জাভাস্ক্রিপ্ট – var, let, const</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/javascript-var-let-const/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">403</post-id>	</item>
		<item>
		<title>Filter</title>
		<link>https://biponnotes.iglyphic.com/filter/</link>
					<comments>https://biponnotes.iglyphic.com/filter/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Tue, 14 Jan 2020 08:28:12 +0000</pubDate>
				<category><![CDATA[ES6]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=364</guid>

					<description><![CDATA[<p>The filter is the same as the map, but if the function applied here returns true, then it will move to the new array, or if the function returns false then that item will not be in the array. Suppose I want to extract only the odd numbers from the following array and place them&#8230;<a href="https://biponnotes.iglyphic.com/filter/" class="more-link">Continue reading <span class="screen-reader-text">Filter</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/filter/">Filter</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>The filter is the same as the <code>map</code>, but if the function applied here returns <code>true</code>, then it will move to the new array, or if the function returns <code>false </code>then that item will not be in the array.<br> Suppose I want to extract only the odd numbers from the following array and place them in the new array:</p>



<p> <code>var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9] </code></p>



<p>Now, by applying a filter method, I can simplify it</p>



<pre class="wp-block-code"><code>var newArr = arr.filter(function(item) {
   return item % 2 == 0
})</code></pre>



<p>Functions are assigned to each <code>item</code>. And the one that returns <code>true </code>here is the new <code>array</code>. And the one that returns <code>false </code>is not in the new array.<br> You can also call here with an anonymous function or an external function, just like a map. View the Result:</p>



<p><code> newArr </code></p>



<figure class="wp-block-image"><img loading="lazy" width="200" height="56" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/13.png?resize=200%2C56&#038;ssl=1" alt="" class="wp-image-365" data-recalc-dims="1"/></figure>



<p>The filter also accentuates <code>three arguments</code> on the map:</p>



<figure class="wp-block-image"><img loading="lazy" width="540" height="240" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/01/14.png?resize=540%2C240&#038;ssl=1" alt="" class="wp-image-366" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/14.png?w=540&amp;ssl=1 540w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/14.png?resize=300%2C133&amp;ssl=1 300w" sizes="(max-width: 540px) 100vw, 540px" data-recalc-dims="1" /></figure>



<p>Using ES6 syntax</p>



<p><code> const newArr = arr.filter(item => item % 2 === 0); </code></p><p>The post <a href="https://biponnotes.iglyphic.com/filter/">Filter</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/filter/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">364</post-id>	</item>
		<item>
		<title>Javascript ES6 &#8211; Map</title>
		<link>https://biponnotes.iglyphic.com/javascript-es6-map/</link>
					<comments>https://biponnotes.iglyphic.com/javascript-es6-map/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Fri, 10 Jan 2020 07:51:17 +0000</pubDate>
				<category><![CDATA[ES6]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://bipon.me/?p=328</guid>

					<description><![CDATA[<p>Javascript&#8217;s ES6 has nothing quite new in our eyes without syntax differences, or syntactic sugar.&#160;But this time we will discuss something completely new.&#160;Yes this thing has been added to ES6 completely new.&#160;It never existed in any previous version of JavaScript.&#160;That&#8217;s the map&#160;Map. Do not mistake&#160;this map&#160;Mapas a map&#160;map.&#160;The reason&#160;mapis a method.&#160;But the map we&#160;Mapwill talk&#8230;<a href="https://biponnotes.iglyphic.com/javascript-es6-map/" class="more-link">Continue reading <span class="screen-reader-text">Javascript ES6 &#8211; Map</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/javascript-es6-map/">Javascript ES6 – Map</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Javascript&#8217;s ES6 has nothing quite new in our eyes without syntax differences, or syntactic sugar.&nbsp;But this time we will discuss something completely new.&nbsp;Yes this thing has been added to ES6 completely new.&nbsp;It never existed in any previous version of JavaScript.&nbsp;That&#8217;s the map&nbsp;<code>Map</code>.</p>



<p>Do not mistake&nbsp;this map&nbsp;<code>Map</code>as a map&nbsp;<code>map</code>.&nbsp;The reason&nbsp;<code>map</code>is a method.&nbsp;But the map we&nbsp;<code>Map</code>will talk about&nbsp;here today&nbsp;is a data structure.&nbsp;The new introduction has been introduced to developers in the ES6 version of JavaScript.&nbsp;But this is a bit different from the object type data structure.&nbsp;It has its own method, its own properties.&nbsp;The map can also access all kinds of functions, booleans, integers, characters, strings.&nbsp;So we will discuss this in detail today.</p>



<h3 id="f564">Map (&nbsp;<code>Map)</code>create:</h3>



<p><strong>Taking a new map: If</strong>&nbsp;we want to take a new map data structure, we can take it like this:</p>



<p>  <code>const&nbsp;bName&nbsp;=&nbsp;new&nbsp;Map() </code></p>



<p> Diameter!&nbsp;There&nbsp;<code>bName</code>a map called.&nbsp;Now inside the map there are keys and values.&nbsp;If we want to put any new value inside this map: </p>



<p> <code>bName.set('fullName',&nbsp;'Bipon&nbsp;Biswas'); </code></p>



<p> Now if you want to access any data from the map, there is another method.&nbsp;Want to know&nbsp;<code>bName</code>&nbsp;<code>fullName</code> </p>



<p><code> bName.get('fullName') </code></p>



<figure class="wp-block-image"><img loading="lazy" width="624" height="138" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/1-2.png?resize=624%2C138&#038;ssl=1" alt="" class="wp-image-332" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/1-2.png?w=624&amp;ssl=1 624w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/1-2.png?resize=300%2C66&amp;ssl=1 300w" sizes="(max-width: 624px) 100vw, 624px" data-recalc-dims="1" /></figure>



<p> Again we can also check if there is a specific value in our map: </p>



<p><code> bName.has('fullName'); </code></p>



<p> Since our map&nbsp;<code>fullName</code>is what it is, it will be true: </p>



<figure class="wp-block-image"><img loading="lazy" width="630" height="142" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/2-1.png?resize=630%2C142&#038;ssl=1" alt="" class="wp-image-335" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/2-1.png?w=630&amp;ssl=1 630w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/2-1.png?resize=300%2C68&amp;ssl=1 300w" sizes="(max-width: 630px) 100vw, 630px" data-recalc-dims="1" /></figure>



<p> Now if that is not the case then it will be false: </p>



<p> <code>bName.has('something'); </code></p>



<figure class="wp-block-image"><img loading="lazy" width="674" height="180" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/01/3-1.png?resize=674%2C180&#038;ssl=1" alt="" class="wp-image-336" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/3-1.png?w=674&amp;ssl=1 674w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/3-1.png?resize=300%2C80&amp;ssl=1 300w" sizes="(max-width: 674px) 100vw, 674px" data-recalc-dims="1" /></figure>



<p> Now we can delete any such pair from the map if we want.&nbsp;First, we have not added another new pair: </p>



<p><code> bName.set('sajib',&nbsp;'biswas') </code></p>



<p> Now if you want to double check whether the new pair has been added to the map: </p>



<p> <code>bName.has('sajib'); </code></p>



<p> Now we want&nbsp;<code>sajib</code>delete&nbsp;this&nbsp;removal: </p>



<p> <code>bName.delete('sajib'); </code></p>



<p> Diameter!&nbsp;Deleted.&nbsp;Now if I check this is&nbsp;<code>sajib</code>there: </p>



<p> <code>bName.has('sajib'); </code></p>



<figure class="wp-block-image"><img loading="lazy" width="589" height="138" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/4-1.png?resize=589%2C138&#038;ssl=1" alt="" class="wp-image-337" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/4-1.png?w=589&amp;ssl=1 589w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/4-1.png?resize=300%2C70&amp;ssl=1 300w" sizes="(max-width: 589px) 100vw, 589px" data-recalc-dims="1" /></figure>



<p> That would be a lie, because we&#8217;ve already deleted it from our map </p>



<figure class="wp-block-image"><img loading="lazy" width="753" height="208" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/01/5-1.png?resize=753%2C208&#038;ssl=1" alt="" class="wp-image-338" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/5-1.png?w=753&amp;ssl=1 753w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/5-1.png?resize=300%2C83&amp;ssl=1 300w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/5-1.png?resize=750%2C207&amp;ssl=1 750w" sizes="(max-width: 753px) 100vw, 753px" data-recalc-dims="1" /></figure>



<p> Now we&nbsp;<code>bName</code>can clear the&nbsp;entire&nbsp;map&nbsp;if we want&nbsp;: </p>



<p><code> bName.clear(); </code></p>



<p> Now if you check&nbsp;<code>bName</code>, nothing can be found inside: </p>



<p> <code>console.log(bName); </code></p>



<figure class="wp-block-image"><img loading="lazy" width="627" height="223" src="https://i0.wp.com/bipon.me/wp-content/uploads/2020/01/6-1.png?resize=627%2C223&#038;ssl=1" alt="" class="wp-image-339" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/6-1.png?w=627&amp;ssl=1 627w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/6-1.png?resize=300%2C107&amp;ssl=1 300w" sizes="(max-width: 627px) 100vw, 627px" data-recalc-dims="1" /></figure>



<p> Suppose we have a map like the following with a few elements: </p>



<p><code> const&nbsp;boxItem&nbsp;=&nbsp;new&nbsp;Map(); </code></p>



<p> Now put some elements inside it: </p>



<pre class="wp-block-code"><code>boxItem.set('name', 'Bipon Biswas');
boxItem.set('job', 'student');
boxItem.set('color', 'blue')
boxItem.set('os', 'windows')
boxItem.set('mobile', 'iOS')
boxItem.set('city', 'dhaka')</code></pre>



<p> Now you will find&nbsp;<code>boxItem</code> all the data inside&nbsp;this&nbsp;map: </p>



<p><code> console.log(boxItem); </code></p>



<figure class="wp-block-image"><img loading="lazy" width="1163" height="307" src="https://i1.wp.com/bipon.me/wp-content/uploads/2020/01/7.png?fit=1024%2C270&amp;ssl=1" alt="" class="wp-image-341" srcset="https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/7.png?w=1163&amp;ssl=1 1163w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/7.png?resize=300%2C79&amp;ssl=1 300w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/7.png?resize=768%2C203&amp;ssl=1 768w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/7.png?resize=1024%2C270&amp;ssl=1 1024w, https://i0.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/7.png?resize=750%2C198&amp;ssl=1 750w" sizes="(max-width: 1040px) 100vw, 1040px" /></figure>



<p> </p>



<p> If we want to know how many elements inside the map we can find the properties of the map&nbsp;<code>size</code>: Now we can also loop in the map if we want: </p>



<p> <code>console.log(boxItem.size); </code></p>



<figure class="wp-block-image"><img loading="lazy" width="756" height="160" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/8.png?resize=756%2C160&#038;ssl=1" alt="" class="wp-image-342" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/8.png?w=756&amp;ssl=1 756w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/8.png?resize=300%2C63&amp;ssl=1 300w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/8.png?resize=750%2C159&amp;ssl=1 750w" sizes="(max-width: 756px) 100vw, 756px" data-recalc-dims="1" /></figure>



<pre class="wp-block-code"><code>boxItem.forEach((value, key) => console.log(`Key is: ${key} and the value is: ${value}`));</code></pre>



<p><code>forEach</code>&nbsp;In the second argument in the method, we usually get the index but here in the case of the map we get the key of the map: </p>



<figure class="wp-block-image"><img loading="lazy" width="761" height="231" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/9.png?resize=761%2C231&#038;ssl=1" alt="" class="wp-image-343" srcset="https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/9.png?w=761&amp;ssl=1 761w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/9.png?resize=300%2C91&amp;ssl=1 300w, https://i2.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/9.png?resize=750%2C228&amp;ssl=1 750w" sizes="(max-width: 761px) 100vw, 761px" data-recalc-dims="1" /></figure>



<p> Likewise, we can&nbsp;<code>for…of</code>also run a loop: </p>



<pre class="wp-block-code"><code>for(let [key, value] of favorite.entries()) {
   console.log(`Key is: ${key} and the value is: ${value}`);
}</code></pre>



<figure class="wp-block-image"><img loading="lazy" width="762" height="222" src="https://i2.wp.com/bipon.me/wp-content/uploads/2020/01/10.png?resize=762%2C222&#038;ssl=1" alt="" class="wp-image-344" srcset="https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/10.png?w=762&amp;ssl=1 762w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/10.png?resize=300%2C87&amp;ssl=1 300w, https://i1.wp.com/biponnotes.iglyphic.com/wp-content/uploads/2020/01/10.png?resize=750%2C219&amp;ssl=1 750w" sizes="(max-width: 762px) 100vw, 762px" data-recalc-dims="1" /></figure>



<p> <strong>Note</strong>: One of the important differences is also that you’re able to use anything for the keys. You’re not just limited to primitive values like symbols, numbers, or strings, but you can even use functions, objects and dates – too. Keys won’t be casted to strings like with regular objects, either.</p>



<pre class="wp-block-code"><code>var map = new Map()
map.set(new Date(), function today () {})
map.set(() => 'key', { pony: 'foo' })
map.set(Symbol('items'), [1, 2])</code></pre>



<p>This is how we can use the newly introduced map in JavaScript ES6. Now, is there more to it than other data structures? Yes this is</p>



<p>In the Map Data Structure:</p>



<p>1.&nbsp;We can easily run the loop.</p>



<p>2.&nbsp;We can find out the size of the map</p>



<p>3. Finally, it is much easier to insert or delete data from the map.</p>



<p><strong><a href="https://ponyfoo.com/articles/es6-maps-in-depth">Reference Source</a></strong></p><p>The post <a href="https://biponnotes.iglyphic.com/javascript-es6-map/">Javascript ES6 – Map</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/javascript-es6-map/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">328</post-id>	</item>
		<item>
		<title>টাইপস্ক্রিপ্ট এসেরশন(Assertion)</title>
		<link>https://biponnotes.iglyphic.com/typescript-assertion/</link>
					<comments>https://biponnotes.iglyphic.com/typescript-assertion/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Sun, 29 Sep 2019 13:54:06 +0000</pubDate>
				<category><![CDATA[টাইপস্ক্রিপ্ট]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[typescript]]></category>
		<guid isPermaLink="false">http://bipon.me/?p=103</guid>

					<description><![CDATA[<p>টাইপস্ক্রিপ্ট এসেরশন(Assertion)&#160; এক্সাম্পল: টাইপ এসেরশন let code: any = 123;&#160; let employeeCode = &#60;number&#62; code;&#160; console.log(typeof(employeeCode)); //Output: number উদাহরণ: অবজেক্ট সহ এসেরশন টাইপ let employee = { }; employee.name = &#8220;John&#8221;; //Compiler Error: Property &#8216;name&#8217; does not exist on type &#8216;{}&#8217; employee.code = 123; //Compiler Error: Property &#8216;code&#8217; does not exist on type &#8216;{}&#8217; উপরের&#8230;<a href="https://biponnotes.iglyphic.com/typescript-assertion/" class="more-link">Continue reading <span class="screen-reader-text">টাইপস্ক্রিপ্ট এসেরশন(Assertion)</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/typescript-assertion/">টাইপস্ক্রিপ্ট এসেরশন(Assertion)</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>টাইপস্ক্রিপ্ট এসেরশন(Assertion)&nbsp;</strong><br></p>



<p><strong>এক্সাম্পল: টাইপ এসেরশন</strong></p>



<p>let code: any = 123;&nbsp;</p>



<p>let employeeCode = &lt;number&gt; code;&nbsp;</p>



<p>console.log(typeof(employeeCode)); //Output: number<br></p>



<p><strong>উদাহরণ: অবজেক্ট সহ এসেরশন টাইপ</strong></p>



<p>let employee = { };</p>



<p>employee.name = &#8220;John&#8221;; //Compiler Error: Property &#8216;name&#8217; does not exist on type &#8216;{}&#8217;</p>



<p>employee.code = 123; //Compiler Error: Property &#8216;code&#8217; does not exist on type &#8216;{}&#8217;<br></p>



<p>উপরের উদাহরণটি একটি কম্পাইলার এরর দেবে, কারণ কম্পাইলার ধরে নিয়েছে যে name or code এই নামে কোন কিছু এক্সিস্ত করে না।&nbsp;<br></p>



<p>তবে, আমরা নীচে দেখানো মত, টাইপ এসেরশন ব্যবহার করে এই পরিস্থিতি এড়াতে পারি।<br></p>



<p><strong>উদাহরণ: অবজেক্ট সহ এসেরশন টাইপ</strong><br></p>



<p>interface Employee {&nbsp;</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;name: string;&nbsp;</p>



<p>&nbsp;&nbsp;&nbsp;&nbsp;code: number;&nbsp;</p>



<p>}&nbsp;<br></p>



<p>let employee = &lt;Employee&gt; { };&nbsp;</p>



<p>employee.name = &#8220;John&#8221;; // OK</p>



<p>employee.code = 123; // OK<br></p>



<p>উপরের উদাহরণে, আমরা ইন্টারফেসের নাম এবং কোড সহ একটি ইন্টারফেস এমপ্লয়ী(Employee) তৈরি করেছি। আমরা এমপ্লয়ী(Employee) এর উপর এসেরশন টাইপ ব্যবহার করেছি । ইন্টারফেস সম্পর্কে <a href="https://www.tutorialsteacher.com/typescript/typescript-interface">আরও</a> জানুন।</p>



<p></p>



<p>টাইপ এ্যাসারেশন ব্যবহার করার সময় সতর্কতা অবলম্বন করুন।<br></p>



<p><strong>টাইপস্ক্রিপ্টে টাইপ এসেরশনের (Assertion) দুটি উপায় রয়েছে:</strong><br></p>



<p>1. কৌণিক বন্ধনী &lt;&gt; সিনট্যাক্স ব্যবহার করা।&nbsp;<br></p>



<p>let code: any = 123;&nbsp;</p>



<p>let employeeCode = &lt;number&gt; code;</p>



<p></p>



<p>তবে &#8216;as&#8217; সিনট্যাক্স ব্যবহার করে টাইপ এসেরশনের <strong>(Assertion)</strong> করার আরও একটি উপায় রয়েছে।<br></p>



<p>২. কীওয়ার্ড হিসাবে ব্যবহার করা<br></p>



<p>let code: any = 123;&nbsp;</p>



<p>let employeeCode = code as number;</p>



<p></p><p>The post <a href="https://biponnotes.iglyphic.com/typescript-assertion/">টাইপস্ক্রিপ্ট এসেরশন(Assertion)</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/typescript-assertion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">103</post-id>	</item>
		<item>
		<title>টাইপস্ক্রিপ্টে ডেটার প্রকারভেদ</title>
		<link>https://biponnotes.iglyphic.com/types-of-data-in-typescript/</link>
					<comments>https://biponnotes.iglyphic.com/types-of-data-in-typescript/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Sun, 29 Sep 2019 12:44:10 +0000</pubDate>
				<category><![CDATA[টাইপস্ক্রিপ্ট]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[typescript]]></category>
		<guid isPermaLink="false">http://bipon.me/?p=100</guid>

					<description><![CDATA[<p>টাইপস্ক্রিপ্টে ডেটার প্রকারভেদ যখনই কোনও ভেরিয়েবল তৈরি করা হয় তখন সেই ভেরিয়েবলের জন্য কিছু মান নির্ধারণের উদ্দেশ্য হয় কিন্তু সেই ভেরিয়েবলের জন্য কী ধরণের মান নির্ধারণ করা যায় তা সেই ভেরিয়েবলের ডেটাটাইপের উপর নির্ভর করে। টাইপস্ক্রিপ্টে, টাইপ সিস্টেম বিভিন্ন ধরণের ডেটাটাইপগুলি উপস্থাপন করে যা টাইপস্ক্রিপ্ট দ্বারা সমর্থিত। বিল্ট-ইন ডাটা টাইপ : Number &#8211;&#160; এটি পূর্ণসংখ্যার&#8230;<a href="https://biponnotes.iglyphic.com/types-of-data-in-typescript/" class="more-link">Continue reading <span class="screen-reader-text">টাইপস্ক্রিপ্টে ডেটার প্রকারভেদ</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/types-of-data-in-typescript/">টাইপস্ক্রিপ্টে ডেটার প্রকারভেদ</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong>টাইপস্ক্রিপ্টে ডেটার প্রকারভেদ</strong><br></p>



<p>যখনই কোনও ভেরিয়েবল তৈরি করা হয় তখন সেই ভেরিয়েবলের জন্য কিছু মান নির্ধারণের উদ্দেশ্য হয় কিন্তু সেই ভেরিয়েবলের জন্য কী ধরণের মান নির্ধারণ করা যায় তা সেই ভেরিয়েবলের ডেটাটাইপের উপর নির্ভর করে। টাইপস্ক্রিপ্টে, টাইপ সিস্টেম বিভিন্ন ধরণের ডেটাটাইপগুলি উপস্থাপন করে যা টাইপস্ক্রিপ্ট দ্বারা সমর্থিত।<br></p>



<p><strong>বিল্ট-ইন ডাটা  টাইপ :<br></strong></p>



<p>Number &#8211;&nbsp; এটি পূর্ণসংখ্যার পাশাপাশি ফ্লোটিং-পয়েন্ট সংখ্যা উভয়কে উপস্থাপন করতে ব্যবহৃত হয়</p>



<p>Boolean &#8211;&nbsp; সত্য এবং মিথ্যা রিপ্রেসেন্ট করে</p>



<p>String &#8211;&nbsp; এটি অক্ষর উপস্থাপন করতে ব্যবহৃত হয়</p>



<p>Void &#8211;&nbsp; ফাংশন রিটার্ন-টাইপগুলিতে সাধারণত ব্যবহৃত হয়</p>



<p>Null &#8211; এটি ব্যবহার করা হয় যখন কোনও অবজেক্টের কোনও মান থাকে না</p>



<p>Undefined &#8211;&nbsp; অস্বীকৃত ভেরিয়েবলকে দেওয়া মানকে চিহ্নিত করে</p>



<p>Any &#8211; যদি ভেরিয়েবলটি কোনও ডেটা-টাইপের সাথে ঘোষণা করা হয় তবে যে কোনও ধরণের মান সেই ভেরিয়েবলের জন্য বরাদ্দ করা যেতে পারে<br></p>



<p><strong>Examples:</strong></p>



<p>let a: null = null;<br></p>



<p>let b: number = 123;<br></p>



<p>let c: number = 123.456;<br></p>



<p>let d: string = ‘Typescript’;<br></p>



<p>let e: undefined = undefined;<br></p>



<p>let f: boolean = true;<br></p>



<p>let g: number = 0b111001; // Binary<br></p>



<p>let h: number = 0o436; // Octal<br></p>



<p>let i: number = 0xadf0d; // Hexa-Decimal<br></p>



<p>let example1: boolean | number = 35;<br></p>



<p><strong>ইউজার-ডিফাইন ডাটা টাইপ:</strong> অন্তর্নির্মিত ডেটা প্রকারগুলি ছাড়াও, ব্যবহারকারী তার নিজস্ব ডেটা প্রকারটিও সংজ্ঞায়িত করতে পারেন। ব্যবহারকারী-সংজ্ঞায়িত প্রকারগুলির মধ্যে এনুমারেশন (এনাম), শ্রেণি, ইন্টারফেস, অ্যারে এবং টিপল অন্তর্ভুক্ত রয়েছে।<br></p>



<p><strong>নোট</strong>: অন্তর্নির্মিত ডেটা টাইপগুলিতে যে কোনও <strong>any</strong> একটি বিশেষ ডেটা-টাইপ, সমস্ত ডাটা টাইপের সুপার ডেটা-টাইপ। যদি কোনও ডেটা টাইপের সাথে ভেরিয়েবল ঘোষণা করা হয় তবে আমরা সেই ভেরিয়েবলের জন্য যে কোনও ধরণের মান নির্ধারণ করতে পারি।<br></p>



<p><strong>Examples:</strong></p>



<p>let a: any = null;<br></p>



<p>let b: any =123;<br></p>



<p>let c: any = 123.456;<br></p>



<p>let d: any = ‘Typescript’;<br></p>



<p>let e: any = undefined;<br></p>



<p>let f: any = true;</p>



<p></p><p>The post <a href="https://biponnotes.iglyphic.com/types-of-data-in-typescript/">টাইপস্ক্রিপ্টে ডেটার প্রকারভেদ</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/types-of-data-in-typescript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">100</post-id>	</item>
		<item>
		<title>Day 1 &#8211; Basic Functioning</title>
		<link>https://biponnotes.iglyphic.com/day-1-basic-functioning/</link>
					<comments>https://biponnotes.iglyphic.com/day-1-basic-functioning/#respond</comments>
		
		<dc:creator><![CDATA[bipon68]]></dc:creator>
		<pubDate>Fri, 13 Sep 2019 19:53:14 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angularcore]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">http://bipon.me/?p=13</guid>

					<description><![CDATA[<p># what and why ?&#160; Framework to build client side application Great for SPAs # Why Modular approach Re-usable code Development quicker and easier (like validation, routing) Unit testable and easily maintainable code Google + Microsoft product (Angular + Typescript) # Angular’s History 2010 &#8211; AngularJS 2016 &#8211; Angular version 2. Just called Angular 2016&#8230;<a href="https://biponnotes.iglyphic.com/day-1-basic-functioning/" class="more-link">Continue reading <span class="screen-reader-text">Day 1 &#8211; Basic Functioning</span></a></p>
<p>The post <a href="https://biponnotes.iglyphic.com/day-1-basic-functioning/">Day 1 – Basic Functioning</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><strong># what and why ?&nbsp;</strong></p>



<p>Framework to build client side application</p>



<p>Great for SPAs<br></p>



<p><strong># Why</strong></p>



<p>Modular approach</p>



<p>Re-usable code</p>



<p>Development quicker and easier (like validation, routing)</p>



<p>Unit testable and easily maintainable code</p>



<p>Google + Microsoft product (Angular + Typescript)<br></p>



<p><strong># Angular’s History</strong></p>



<p>2010 &#8211; AngularJS</p>



<p>2016 &#8211; Angular version 2. Just called Angular</p>



<p>2016 Dec &#8211; Angular version 4</p>



<p>2017 Nov &#8211; Angular version 5</p>



<p>2018 Oct &#8211; Angular version 7</p>



<p></p>



<p><strong>Day1 &#8211; Basic Functioning&nbsp;</strong><br></p>



<p><strong>Prerequisites &#8211; to learn Angular</strong><br></p>



<ul><li>HTML, CSS, JS</li><li>Basic of Typescript</li></ul>



<p><strong>Development Environment:&nbsp;</strong></p>



<ul><li>Node &#8211; <a href="https://nodejs.org/en/">https://nodejs.org/en/</a></li><li>Node Version check &#8211; node -v</li><li>NPM (npm install -g. Check = npm -v)</li><li>Angular CLI (npm install -g @angular/cli)</li><li>CLI version check (ng -v)</li><li>Text Editor like VS Editor</li></ul>



<p>&nbsp;<strong>New project creation&nbsp;</strong></p>



<ul><li>Open your Git bash interface and then write bellow command&nbsp;</li></ul>



<ul><li>ng new project_name (ng new hello-world)&nbsp;</li></ul>



<p><strong>#way 2</strong></p>



<p>VS Editor</p>



<ul><li>View &gt;&gt; Integrated Terminal &gt;&gt; ng new hello-world</li><li>Going to project &#8211; cd hello-world</li><li>Run the project &#8211; ng serve</li><li>After compile successfully&nbsp;</li><li>Then going to browser localhost:4200</li></ul>



<p></p>



<p><strong>Module</strong></p>



<ul><li>First building block is a Module</li></ul>



<ul><li>Angular application is collection individual module</li><li>Angular must have on module <strong>Root Module</strong> &#8211; AppModule<ul><li>Module have two things</li><li>Component (Root component &#8211; AppComponent)</li><li>Service &#8211; Here have business logic</li></ul></li><li>Export and Import (interact and ultimately render the view in the browser)</li></ul>



<p>Component</p>



<ul><li>Angular must have on component Root component &#8211; AppComponent&nbsp;<ul><li>Component have two things</li><li>HTML Template (To represent the view)</li><li>Class (View logic &#8211; control the particular logic)</li></ul></li></ul>



<p>Service&nbsp;</p>



<ul><li>Module&nbsp;<ul><li>Service under Module&nbsp;</li><li>Service there write business logic of your application&nbsp;</li></ul></li></ul>



<p>Architecture Summary&nbsp;</p>



<ul><li>Angular app &#8211; one or more modules</li><li>Module &#8211; one or more components and services</li><li>Components &#8211; HTML (contain the html template) + Class (class control the logic for the particular view )</li><li>Service &#8211; Business Logic (contains the business logic)</li><li>Modules interact and ultimately render the view in the browser&nbsp;</li></ul>



<p>Package.json</p>



<ul><li>This file contains the dependency &amp; the dev dependency that are required for angular application&nbsp;</li><li>Project run &#8211; ng serve or npm start (npm start means internally call ng serve)</li></ul>



<p>Main.ts&nbsp;</p>



<ul><li>This is the entry point to the application&nbsp;</li><li>If run the ng serve command then application come to main.ts file then bootstrap and kickstart appModule → bootstrap appComponent. And appComponent (have two things HTML template + class (contains the data for particular view logic)</li><li>) and render the HTML.&nbsp; Initially class have title property sync/bound with component html by interpolation. Also other html is static&nbsp;</li></ul>



<p>App.module.ts:&nbsp;</p>



<ul><li>This is the main module for any angular application. Also app.component.ts file is the root component of angular application&nbsp;</li></ul>



<p>Operation flow:&nbsp;</p>



<ul><li>When we run the command ng serve into git bash then execution comes to <strong>main.ts</strong> file . then goes to <strong>app.module.ts</strong> file. then <strong>bootstrap: [AppComponent]</strong>&nbsp;</li><li>Then goes to <strong>app.component</strong>&nbsp;</li><li>Then data property title gets render in the <strong>app.component.html&nbsp;</strong></li><li>&nbsp;AppComponent have two things<ul><li>Html file</li><li>Component &#8211; (contain class &gt;&nbsp; to control the view logic)</li></ul></li></ul><p>The post <a href="https://biponnotes.iglyphic.com/day-1-basic-functioning/">Day 1 – Basic Functioning</a> first appeared on <a href="https://biponnotes.iglyphic.com">Bipon's Diary</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://biponnotes.iglyphic.com/day-1-basic-functioning/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">13</post-id>	</item>
	</channel>
</rss>
