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

<channel>
	<title>ES6 Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/es6/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/es6/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Wed, 10 Jul 2019 12:51:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>ES6: var vs let vs const</title>
		<link>https://creatronix.de/es6-var-vs-let-vs-const/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Fri, 18 Aug 2017 19:57:49 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ES6]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=988</guid>

					<description><![CDATA[<p>Dealing with KnockoutJS I came across some newer features of the JavaScript language ES6 TL;DR: don&#8217;t use var anymore when You declare variables. Some examples: As You can see a variable declared with the var keyword is visible outside its enclosing scope. Most of the time it&#8217;s not what You want. When You enable ES6&#8230;</p>
<p>The post <a href="https://creatronix.de/es6-var-vs-let-vs-const/">ES6: var vs let vs const</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Dealing with KnockoutJS I came across some newer features of the JavaScript language ES6</p>
<p>TL;DR: don&#8217;t use <strong>var</strong> anymore when You declare variables.</p>
<p>Some examples:</p>
<p><span id="more-988"></span><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-996" src="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.42.41.png" alt="" width="399" height="481" srcset="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.42.41.png 399w, https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.42.41-249x300.png 249w" sizes="(max-width: 399px) 100vw, 399px" /></p>
<p>As You can see a variable declared with the <strong>var</strong> keyword is visible outside its enclosing scope. Most of the time it&#8217;s not what You want.</p>
<p>When You enable ES6 support in PyCharm it already warns You if You use <strong>var:</strong></p>
<p><img decoding="async" class="alignnone size-full wp-image-997" src="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.42.56.png" alt="" width="521" height="182" srcset="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.42.56.png 521w, https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.42.56-300x105.png 300w" sizes="(max-width: 521px) 100vw, 521px" /></p>
<p>To declared a variable which is on visible in its scope You can either use let or const.</p>
<p><img decoding="async" class="alignnone size-full wp-image-998" src="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.53.04.png" alt="" width="480" height="180" srcset="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.53.04.png 480w, https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.53.04-300x113.png 300w" sizes="(max-width: 480px) 100vw, 480px" /></p>
<p><strong>Let</strong> lets your variable be mutable so you can use it in a loop as counter. If You want to guarantee even more that one variable is used for one concept only You can use <strong>const</strong> which makes the variable immutable.</p>
<p><img decoding="async" class="alignnone size-full wp-image-999" src="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.43.27.png" alt="" width="489" height="153" srcset="https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.43.27.png 489w, https://creatronix.de/wp-content/uploads/2017/08/Bildschirmfoto-2017-08-18-um-21.43.27-300x94.png 300w" sizes="(max-width: 489px) 100vw, 489px" /></p>
<p>&nbsp;</p>
<p>The post <a href="https://creatronix.de/es6-var-vs-let-vs-const/">ES6: var vs let vs const</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
