<?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>Igor Cardozo, Author at asap developers</title>
	<atom:link href="https://www.asapdevelopers.com/author/igor-cardozo/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.asapdevelopers.com/author/igor-cardozo/</link>
	<description>San Francisco Mobile App Developers</description>
	<lastBuildDate>Thu, 11 Mar 2021 18:02:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.1</generator>

<image>
	<url>https://www.asapdevelopers.com/wp-content/uploads/2017/04/favicon-asap-1.png</url>
	<title>Igor Cardozo, Author at asap developers</title>
	<link>https://www.asapdevelopers.com/author/igor-cardozo/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>JavaScript Vs TypeScript</title>
		<link>https://www.asapdevelopers.com/javascript-vs-typescript/</link>
		
		<dc:creator><![CDATA[Igor Cardozo]]></dc:creator>
		<pubDate>Mon, 07 Dec 2020 18:41:19 +0000</pubDate>
				<category><![CDATA[Agile Methodologies]]></category>
		<guid isPermaLink="false">https://www.asapdevelopers.com/?p=13967</guid>

					<description><![CDATA[<p>JavaScript Vs TypeScript In this article, we’ll be comparing JavaScript vs TypeScript by going over the various aspects and attributes they offer. TypeScript’s popularity is increasing with each coming year....</p>
<p>The post <a rel="nofollow" href="https://www.asapdevelopers.com/javascript-vs-typescript/">JavaScript Vs TypeScript</a> appeared first on <a rel="nofollow" href="https://www.asapdevelopers.com">asap developers</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h1><b>JavaScript Vs TypeScript</b></h1>
<p>In this article, we’ll be comparing JavaScript vs TypeScript by going over the various aspects and attributes they offer.</p>
<p><span style="font-weight: 400;">TypeScript’s popularity is increasing with each coming year. According to </span><a href="https://2019.stateofjs.com/javascript-flavors/typescript/"><span style="font-weight: 400;">State Of Js</span></a><span style="font-weight: 400;">, most developers have either used this language and liked it or have heard about it and want to start using it. Moreover, famous frameworks like Angular or React use or have pre-configured templates that include TypeScript on their initial project. However, not everyone uses this language and there’s still a large community that uses <a href="https://www.asapdevelopers.com/unit-testing-best-javascript-frameworks/">JavaScript</a>.</span></p>
<h2><span style="font-weight: 400;"><img decoding="async" loading="lazy" class="size-medium wp-image-13988 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/ts-vs-ts-300x169.png" alt="javascript vs typescript" width="300" height="169" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/ts-vs-ts-300x169.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/ts-vs-ts-1024x577.png 1024w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/ts-vs-ts-768x433.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/ts-vs-ts.png 1512w" sizes="(max-width: 300px) 100vw, 300px" /></span></h2>
<h2><span style="font-weight: 400;">Documentation</span></h2>
<p><span style="font-weight: 400;">When using third-party libraries or packages, you will probably need to read some documentation from sources such as npm or GitHub. This is definitely the case with JavaScript.</span></p>
<p><span style="font-weight: 400;">However, when using TypeScript and VS Code, you can see the documentation right in your IDE:</span></p>
<p><span style="font-weight: 400;">Let’s see an example using </span><i><span style="font-weight: 400;">node </span></i><span style="font-weight: 400;">and </span><i><span style="font-weight: 400;">express</span></i><span style="font-weight: 400;">.</span></p>
<p><script src="https://gist.github.com/igorcardozo/d89db6dc69a6ca756a1881610894b6ba.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/d89db6dc69a6ca756a1881610894b6ba"><span style="font-weight: 400;">script</span></a></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">The cool thing about this is that if you don’t know what the </span><i><span style="font-weight: 400;">send </span></i><span style="font-weight: 400;">function does, you can just place the cursor on it and get some information:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class="aligncenter wp-image-13989" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black1-300x132.png" alt="javascript vs typescript" width="540" height="237" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black1-300x132.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black1-1024x449.png 1024w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black1-768x337.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black1.png 1169w" sizes="(max-width: 540px) 100vw, 540px" /></span></p>
<p><span style="font-weight: 400;">Also, if you want to know more about what the variable </span><i><span style="font-weight: 400;">res</span></i><span style="font-weight: 400;"> can do, you can just hit </span><i><span style="font-weight: 400;">Ctrl + .</span></i><span style="font-weight: 400;"> or </span><i><span style="font-weight: 400;">Cmd + .</span></i><span style="font-weight: 400;"> :</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class="aligncenter wp-image-13990" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black2-300x129.png" alt="javascript vs typescript" width="543" height="233" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black2-300x129.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black2-1024x439.png 1024w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black2-768x329.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black2.png 1454w" sizes="(max-width: 543px) 100vw, 543px" /></span></p>
<p><span style="font-weight: 400;">Moreover, when working on a project with teammates, you don’t need a lot of documentation if you are using TypeScript. Using good function/variable names and setting the types to each variable/function, should be enough to express the responsibility of that variable/function. Of course, there are exceptions in which a function is too complicated and a comment would make it easier to understand, but this should be an exception. It’s always best to avoid commented code.</span></p>
<h2><span style="font-weight: 400;">Modifying a function: JavaScript Vs TypeScript</span></h2>
<p><span style="font-weight: 400;">Let’s see an example of a </span><i><span style="font-weight: 400;">sum</span></i><span style="font-weight: 400;"> function in JavaScript.</span></p>
<p><script src="https://gist.github.com/igorcardozo/1b9796bcabdc6aec1aadb82d7f246410.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/1b9796bcabdc6aec1aadb82d7f246410"><span style="font-weight: 400;">script</span></a><br />
<span style="font-weight: 400;">The result of executing the code is:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-13991 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black3-300x30.png" alt="code3" width="510" height="51" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black3-300x30.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black3-768x76.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black3.png 869w" sizes="(max-width: 510px) 100vw, 510px" /></span></p>
<p><span style="font-weight: 400;">As you can see, JavaScript lets you use the same </span><i><span style="font-weight: 400;">sum</span></i><span style="font-weight: 400;"> function for both strings and integers, which could be an advantage, as you can use the same function for multiple types and get a result without checking the types of the parameters.</span></p>
<p><span style="font-weight: 400;">However, let’s modify our function to add the first elements of two arrays, like this:</span></p>
<p><script src="https://gist.github.com/igorcardozo/bab982e31b78bee50f5743272170f32a.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/bab982e31b78bee50f5743272170f32a"><span style="font-weight: 400;">script</span></a></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">The result of executing this code is:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-13992 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black4-300x27.png" alt="code4" width="512" height="46" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black4-300x27.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black4-768x70.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black4.png 860w" sizes="(max-width: 512px) 100vw, 512px" /></span></p>
<p><span style="font-weight: 400;">As you can see, it seems to work well with strings, but we get a </span><i><span style="font-weight: 400;">NaN</span></i><span style="font-weight: 400;"> with integers because we cannot access a specific index of an integer.</span></p>
<p><span style="font-weight: 400;">The example includes very simple code, but if we were dealing with real software, where you have to modify a function that impacts or is used by a lot of other functions or other external services, this could become a problem. You may need to know exactly what the parameters are, and what they represent, and what the function you’re modifying is returning. </span></p>
<p><span style="font-weight: 400;">JavaScript gives you the freedom to manage the code however you like, but if you are returning an array where you’re meant to return a string, other functions or services using your function are likely to crash or you may even get an unexpected result.</span></p>
<p><span style="font-weight: 400;">On TypeScript, the same function would look like this:</span></p>
<p><script src="https://gist.github.com/igorcardozo/1bd29335afdaa948ba603009d6e4785c.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/1bd29335afdaa948ba603009d6e4785c"><span style="font-weight: 400;">script</span></a></p>
<p><span style="font-weight: 400;">As you can see, we are specifying the type for each parameter, which allows us to know that we are receiving a number as a parameter and returning a number as well.</span></p>
<p><span style="font-weight: 400;">This means that if you call the </span><i><span style="font-weight: 400;">add</span></i><span style="font-weight: 400;"> function with a string, as in the example below, you will get an error:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class="aligncenter wp-image-13993" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black5-300x83.png" alt="javascript vs typescript" width="564" height="156" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black5-300x83.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black5-768x211.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black5.png 949w" sizes="(max-width: 564px) 100vw, 564px" /></span></p>
<p><span style="font-weight: 400;">If you are using VS Code, you can see this before you even run the code:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class="aligncenter wp-image-13994" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black6-300x49.png" alt="javascript vs typescript" width="588" height="96" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black6-300x49.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black6-1024x168.png 1024w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black6-768x126.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black6.png 1459w" sizes="(max-width: 588px) 100vw, 588px" /></span></p>
<p><span style="font-weight: 400;">The same happens if you return something other than a number:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class="aligncenter wp-image-13995" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black7-300x96.png" alt="javascript vs typescript" width="559" height="179" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black7-300x96.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black7-768x245.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black7-900x290.png 900w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black7.png 908w" sizes="(max-width: 559px) 100vw, 559px" /></span></p>
<p><span style="font-weight: 400;">Another example would be to add or remove parameters from a shared function.</span></p>
<p><span style="font-weight: 400;">Let’s assume we have the following structure:</span></p>
<p><span style="font-weight: 400;"><code>src<br />
|- index.js<br />
|- utils.js</code></span></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">In </span><i><span style="font-weight: 400;">utils.js</span></i><span style="font-weight: 400;"> we have a function that only concatenates two strings with a space between them:</span></p>
<p><script src="https://gist.github.com/igorcardozo/dda5f54d589f852b4cd569dae7b514f5.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/dda5f54d589f852b4cd569dae7b514f5"><span style="font-weight: 400;">script</span></a></p>
<p><span style="font-weight: 400;">And in </span><i><span style="font-weight: 400;">index.js</span></i><span style="font-weight: 400;"> we call this function like this:</span></p>
<p><script src="https://gist.github.com/igorcardozo/dcda4697b6c80f40aea5825117ac22cd.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/dcda4697b6c80f40aea5825117ac22cd"><span style="font-weight: 400;">script</span></a></p>
<p><span style="font-weight: 400;">If in the future we need to modify this function and add more parameters (in our example, we need to concatenate 3 strings instead of 2), in JavaScript we would modify </span><i><span style="font-weight: 400;">concatStrings</span></i><span style="font-weight: 400;"> like this:</span></p>
<p><script src="https://gist.github.com/igorcardozo/f8418cd3ab0f90f42da0ddb163d1d46c.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/f8418cd3ab0f90f42da0ddb163d1d46c"><span style="font-weight: 400;">script</span></a><br />
<span style="font-weight: 400;">If we do not modify our code on </span><i><span style="font-weight: 400;">index.js</span></i><span style="font-weight: 400;"> to pass another parameter to our function, we will not notice any errors until we run the code:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-13996 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black8-300x27.png" alt="code8" width="533" height="48" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black8-300x27.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black8-768x69.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black8.png 787w" sizes="(max-width: 533px) 100vw, 533px" /></span></p>
<p><span style="font-weight: 400;">Here we are only using our function in one part of the code, but if you were using this code in multiple locations of a large project, you would not get an error anywhere because it would not crash. Instead, you would get an unexpected behavior because, somewhere, you would be getting an </span><i><span style="font-weight: 400;">undefined</span></i><span style="font-weight: 400;"> where a different result was expected.</span></p>
<p><span style="font-weight: 400;">Let’s see what happens when we use TypeScript. </span><span style="font-weight: 400;">The structure would be the same, but with </span><i><span style="font-weight: 400;">ts</span></i><span style="font-weight: 400;"> extensions:</span></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;"><code>src<br />
|- index.ts<br />
|- utils.ts</code></span></p>
<p><span style="font-weight: 400;">The</span><i><span style="font-weight: 400;"> utils.ts</span></i><span style="font-weight: 400;"> file would look like this:</span></p>
<p><script src="https://gist.github.com/igorcardozo/9a898b2b9e673d33843f31849a02fa3b.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/9a898b2b9e673d33843f31849a02fa3b"><span style="font-weight: 400;">script</span></a></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">And the </span><i><span style="font-weight: 400;">index.ts </span></i><span style="font-weight: 400;">file would look like this:</span></p>
<p><script src="https://gist.github.com/igorcardozo/aff74aafa07ab735b4eedfd9dd6f8437.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/aff74aafa07ab735b4eedfd9dd6f8437"><span style="font-weight: 400;">script</span></a></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">Here, if you failed to provide all parameters, the interpreter would tell you that something is wrong:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-13997 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black9-300x88.png" alt="code9" width="477" height="140" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black9-300x88.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black9-1024x302.png 1024w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black9-768x226.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black9.png 1123w" sizes="(max-width: 477px) 100vw, 477px" /></span></p>
<p><span style="font-weight: 400;">And if you ran the code, you would get the following error:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-13998 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black10-300x81.png" alt="code10" width="500" height="135" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black10-300x81.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black10-1024x277.png 1024w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black10-768x208.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black10.png 1068w" sizes="(max-width: 500px) 100vw, 500px" /></span></p>
<p><span style="font-weight: 400;">This is one of the advantages of TypeScript because we know exactly what went wrong and where. Therefore, other functions won’t get an expected result and work as if nothing had happened.</span></p>
<h2><span style="font-weight: 400;">Missing imports</span></h2>
<p><span style="font-weight: 400;">Let’s follow the same structure as the example above, but adding the </span><i><span style="font-weight: 400;">add</span></i><span style="font-weight: 400;"> function to the </span><i><span style="font-weight: 400;">utils.ts</span></i><span style="font-weight: 400;"> file, and using it on the </span><i><span style="font-weight: 400;">index.ts </span></i><span style="font-weight: 400;">file</span><i><span style="font-weight: 400;">:</span></i></p>
<p><script src="https://gist.github.com/igorcardozo/5e2609c6918dff0806c99b6c5928e99a.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/5e2609c6918dff0806c99b6c5928e99a"><span style="font-weight: 400;">script</span></a></p>
<p>&nbsp;</p>
<p><script src="https://gist.github.com/igorcardozo/1b631749d11cebbfb99a4b86c17eff65.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/1b631749d11cebbfb99a4b86c17eff65"><span style="font-weight: 400;">script</span></a></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">If you are using VS Code, you would get some warnings on the </span><i><span style="font-weight: 400;">index.ts</span></i><span style="font-weight: 400;"> file:</span></p>
<p>&nbsp;</p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-13999 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black11-300x78.png" alt="code11" width="481" height="125" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black11-300x78.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black11-768x201.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black11.png 811w" sizes="(max-width: 481px) 100vw, 481px" /></span></p>
<p><span style="font-weight: 400;">As you can see, we need to import these functions.</span></p>
<p><span style="font-weight: 400;">Using TypeScript and VS Code, we can import all the functions that are being used by tapping </span><i><span style="font-weight: 400;">Ctrl + .</span></i><span style="font-weight: 400;"> or </span><i><span style="font-weight: 400;">CMD + .</span></i><span style="font-weight: 400;"> and selecting “</span><i><span style="font-weight: 400;">Add all missing imports</span></i><span style="font-weight: 400;">”:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-14000 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black12-300x97.png" alt="code12" width="479" height="155" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black12-300x97.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black12-768x248.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black12.png 787w" sizes="(max-width: 479px) 100vw, 479px" /></span></p>
<p><span style="font-weight: 400;">Unfortunately, this feature is not available in JavaScript.</span></p>
<h2><span style="font-weight: 400;">Using interfaces: JavaScript vs TypeScript</span></h2>
<p><span style="font-weight: 400;">We can get the best out of interfaces using TypeScript.</span></p>
<p><span style="font-weight: 400;">You can create an interface like this:</span></p>
<p><script src="https://gist.github.com/igorcardozo/a387381b594fcc963466e968c38dd3e3.js"></script><br />
<b>Link:</b> <a href="https://gist.github.com/igorcardozo/a387381b594fcc963466e968c38dd3e3"><span style="font-weight: 400;">script</span></a></p>
<p><span style="font-weight: 400;">If you have a function that receives a </span><i><span style="font-weight: 400;">User</span></i><span style="font-weight: 400;"> as an argument, you could access its properties without looking at its file:</span></p>
<p><span style="font-weight: 400;"><img decoding="async" loading="lazy" class=" wp-image-14001 aligncenter" src="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black13-300x67.png" alt="code13" width="489" height="109" srcset="https://www.asapdevelopers.com/wp-content/uploads/2020/12/black13-300x67.png 300w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black13-768x170.png 768w, https://www.asapdevelopers.com/wp-content/uploads/2020/12/black13.png 929w" sizes="(max-width: 489px) 100vw, 489px" /></span></p>
<p><span style="font-weight: 400;">Although JavaScript has grown as an OOP language in recent versions, as of today, it does not have a native way of implementing interfaces.</span></p>
<h2><span style="font-weight: 400;">Summary</span></h2>
<p><span style="font-weight: 400;">Now that we’ve looked at the main features, here is a summary of the pros and cons for each language:</span></p>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">JavaScript gives you the “freedom” to use your code by sharing functions and variables without specifying a type, and passing anything you want without compiling errors. However, remember that you will probably work with other people, who may not understand your code, and comments could make it ugly. </span></li>
<li><span style="font-weight: 400;">TypeScript gives a better understanding of your code by introducing typing, so others (teammates or clients) can use it with the confidence of knowing what it does and what it needs.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">As JavaScript is an interpreted language, you won’t get the errors until you run the code. TypeScript allows you to find those errors sooner.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">On TypeScript, you can use interfaces to specify your own “types” and make the code cleaner and understandable.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">TypeScript allows you to go through documentation more easily and faster, as well as make your own documentation a lot simpler.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">TypeScript needs to transpile the code to JavaScript (as browsers only understand javascript), so this makes it a bit slower.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">TypeScript would take more time to configure and code than JavaScript as you need to specify types and probably have a different structure. However, you will save this time on finding bugs and errors.</span></li>
</ul>
<p>&nbsp;</p>
<h2><span style="font-weight: 400;">Final thoughts on JavaScript vs TypeScript</span></h2>
<p><span style="font-weight: 400;">Both languages have their pros and cons and their extra features. Choosing between the two will come down to your team’s needs or even the needs of each specific project. We hope this article has given you enough information to make the right choice.</span></p>

		<div id="fws_6937d2cfc3408"  data-column-margin="default" data-midnight="dark"  data-bg-mobile-hidden="" class="wpb_row vc_row-fluid vc_row top-level standard_section "  style="padding-top: 0px; padding-bottom: 0px; "><div class="row-bg-wrap" data-bg-animation="none" data-bg-overlay="false"><div class="inner-wrap"><div class="row-bg"  style=""></div></div><div class="row-bg-overlay" ></div></div><div class="col span_12 dark left">
	<div  class="vc_col-sm-12 wpb_column column_container vc_column_container col no-extra-padding"  data-t-w-inherits="default" data-border-radius="none" data-shadow="none" data-border-animation="" data-border-animation-delay="" data-border-width="none" data-border-style="solid" data-border-color="" data-bg-cover="" data-padding-pos="all" data-has-bg-color="false" data-bg-color="" data-bg-opacity="1" data-hover-bg="" data-hover-bg-opacity="1" data-animation="" data-delay="0" >
		<div class="vc_column-inner" ><div class="column-bg-overlay-wrap" data-bg-animation="none"><div class="column-bg-overlay"></div></div>
			<div class="wpb_wrapper">
				<a class="nectar-button large regular accent-color has-icon  wpb_animate_when_almost_visible wpb_bounce bounce regular-button"  style="margin-top: 40px; color: #ffffff; "  href="https://www.asapdevelopers.com/web-mobile-app-san-francisco/" data-color-override="false" data-hover-color-override="false" data-hover-text-color-override="#fff"><span>Mobile App Development Company</span><i style="color: #ffffff;"  class="icon-button-arrow"></i></a>
			</div> 
		</div>
	</div> 
</div></div>
<p>The post <a rel="nofollow" href="https://www.asapdevelopers.com/javascript-vs-typescript/">JavaScript Vs TypeScript</a> appeared first on <a rel="nofollow" href="https://www.asapdevelopers.com">asap developers</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
