{"id":418464,"date":"2022-03-19T13:00:03","date_gmt":"2022-03-19T10:00:03","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/the-differences-between-javascript-and-typescript\/"},"modified":"2022-03-19T13:00:03","modified_gmt":"2022-03-19T10:00:03","slug":"the-differences-between-javascript-and-typescript","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/","title":{"rendered":"#The differences between Javascript and Typescript"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a3a95077b230\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a3a95077b230\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#%E2%80%9CThe_differences_between_Javascript_and_Typescript%E2%80%9D\" >&#8220;The differences between Javascript and Typescript&#8221;<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#What_is_JavaScript\" >What is JavaScript?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#What_is_TypeScript\" >What is TypeScript?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#Why_TypeScript_Emerged\" >Why TypeScript Emerged?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#Key_Differences_between_JavaScript_and_TypeScript\" >Key Differences between JavaScript and TypeScript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#Is_TypeScript_better_than_JavaScript\" >Is TypeScript better than JavaScript?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#Disadvantages_of_TypeScript\" >Disadvantages of TypeScript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#When_should_you_migrate_your_project_to_TypeScript\" >When should you migrate your project to TypeScript?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/buradabiliyorum.com\/en\/the-differences-between-javascript-and-typescript\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E2%80%9CThe_differences_between_Javascript_and_Typescript%E2%80%9D\"><\/span>&#8220;The differences between Javascript and Typescript&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p><img decoding=\"async\" src=\"https:\/\/img-cdn.tnwcdn.com\/image?fit=796%2C417&amp;url=https%3A%2F%2Fcdn0.tnwcdn.com%2Fwp-content%2Fblogs.dir%2F1%2Ffiles%2F2022%2F03%2Fmarkus-spiske-iar-afB0QQw-unsplash.jpg&amp;signature=aa39b814027fb1b08270e02bcbb99bb0\" \/><\/p>\n<div>\n                            <em>This article was originally published on <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/cult.honeypot.io\/\">.cult<\/a> by <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/cult.honeypot.io\/contributors\/piumi-Gunawardhana\">Piumi Gunawardhana<\/a><\/em><em>. .cult is a Berlin-based community platform for developers. We write about all things career-related, make original documentaries and share heaps of other untold developer stories from around the world.<\/em><\/p>\n<p>In the beginning, there was Java<a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">Script<\/a>. The popular scripting language we all know and love. Ever since its creation, it\u2019s been the dominating language for web development. Then two decades later, Microsoft introduced TypeScript, a superset of JavaScript, designed for the development of large web applications.<\/p>\n<p>                <iframe loading=\"lazy\" src=\"https:\/\/fast.wistia.net\/embed\/iframe\/4ur6s9bbic?videoFoam=true&amp;autoPlay=true\" title=\"\" allowtransparency=\"true\" frameborder=\"0\" scrolling=\"no\" class=\"wistia_embed\" name=\"wistia_embed\" allowfullscreen=\"\" msallowfullscreen=\"\" width=\"100%\" height=\"100%\"><\/iframe><\/p>\n<p>If you know anything about Typescript and JavaScript, you\u2019ll know they\u2019re not competing forces. They have a unique relationship, working hand in hand. That being said, there are some differences \u2014 and that\u2019s what I want to discuss in this article. Let\u2019s break down the pros and cons so you can better decide which scripting language is right for your next web application.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_is_JavaScript\"><\/span>What is JavaScript?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>JavaScript is the most popular programming language in the world.<\/p>\n<p>Let\u2019s start at the beginning. JavaScript has been the core <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/technology\/\" data-internallinksmanager029f6b8e52c=\"4\" title=\"Technology\" target=\"_blank\" rel=\"noopener\">technology<\/a> for web applications since the 90s. It\u2019s used to create interactive web pages in combination with HTML and CSS. It\u2019s a high-level language with dynamic typing and a JIT (Just-in-Time) compiler.<\/p>\n<p>JavaScript is a multi-paradigm language that supports various programming styles like functional programming, imperative programming styles, and event-driven programming. It also supports server-side implementations. JavaScript is formed on the basis of the ECMAScript (ES) standard. The most widely used ES standards with JavaScript are ES5 and ES6.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_is_TypeScript\"><\/span>What is TypeScript?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>TypeScript (TS) is a JavaScript superset that serves the same goal as JavaScript.<\/p>\n<p>TypeScript is an open-source programming language rich in many features like inheritance, classes, visibility scopes, namespaces, interfaces, unions, and other modern features along with static and dynamic typing. It allows comments, variables, functions, statements, modules, and expressions.<\/p>\n<p>Being a strongly typed programming language, TypeScript allows easier debugging (during the compilation), which is a more effective approach to codingfor complex applications.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Why_TypeScript_Emerged\"><\/span>Why TypeScript Emerged?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The complexity of JavaScript projects tends to grow exponentially. Initially, JavaScript was only used as a client-side language. But developers realised that it could also be used as a server-side programming language.<\/p>\n<p>Despite the advantages of JavaScript, it can get messy and complex on the server-side (especially with larger-scale apps). In addition, JavaScript has also made it hard to maintain larger complex applications.<\/p>\n<p>Browser improvements and cross-browser compatibility also demand changes for the underlying JavaScript but writing future-proof JavaScript isn\u2019t practical. As a result, TypeScript emerged to meet these application needs.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Key_Differences_between_JavaScript_and_TypeScript\"><\/span>Key Differences between JavaScript and TypeScript<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<table id=\"tablepress-47\" class=\"tablepress tablepress-id-47\">\n<thead>\n<tr class=\"row-1 odd\">\n<th class=\"column-1\">Javascript<\/th>\n<th class=\"column-2\">Typescript<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-hover\">\n<tr class=\"row-2 even\">\n<td class=\"column-1\">Supports dynamic web page contentThe language is interpreted, therefore errors are only discovered during runtime<\/p>\n<p>Weakly typed, no choice for static typing<\/p>\n<p>Can be used directly in browsers<\/p>\n<p>Modules, generics, and interfaces are not supported<\/p>\n<p>Does not support optional parameters<\/p>\n<p>Numbers and Strings are used as interfaces<\/p>\n<p>Massive community support, including extensive documentation<\/p>\n<p>There is no support for prototyping<\/p>\n<p>No prior scripting knowledge is required<\/p>\n<p>No need to set up a build environment<\/p>\n<\/td>\n<td class=\"column-2\">JavaScript superset created to help the project with code complexityDuring compilation errors can be detected and fixed<\/p>\n<p>Strongly typed; both static and dynamic typing are supported<\/p>\n<p>Converts code to JS for browser compatibility<\/p>\n<p>Supports modules, generics, and interfaces<\/p>\n<p>Optional parameters can be added to functions<\/p>\n<p>For static type definitions, a proper build setup (npm package) is necessary<\/p>\n<p>Numbers and strings are objects<\/p>\n<p>Community support is growing, not as strong as it once was<\/p>\n<p>Prototyping is a viable option<\/p>\n<p>Learning and coding takes time, scripted knowledge is required<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span class=\"ez-toc-section\" id=\"Is_TypeScript_better_than_JavaScript\"><\/span>Is TypeScript better than JavaScript?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The way I\u2019ve described it, it might seem like TypeScript is just a better version of JS. So you might think it\u2019s likely TS will replace JavaScript in near future\u2026 well not really. I still believe JavaScript will have its place.<\/p>\n<p>Complexity is a key factor to consider.<\/p>\n<p>JavaScript is ideal for simpler applications because it operates on all platforms (cross-platform) and is very lightweight. Additionally, compiling TypeScript code requires time and CPU resources compared to a minimal overhead with JS. Sometimes the hassle of using TypeScript doesn\u2019t make sense for the project.<\/p>\n<p>However, TypeScript comes with many benefits over JavaScript.<\/p>\n<p>TS makes code refactoring much easier and also emphasizes more on explicit types allowing the developer to grasp how various components interact. As it supports compile-time debugging, there\u2019s a definite benefit to organizations working with large complex applications.<\/p>\n<p>Setting up TypeScript for any project is straightforward. Some frameworks like Angular use TypeScript by default. So, in my opinion, TypeScript is the clear winner here.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Disadvantages_of_TypeScript\"><\/span>Disadvantages of TypeScript<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Despite the many advantages that TypeScript provides, it also has certain disadvantages.<\/p>\n<p>Defining types explicitly requires more work initially but saves both time and resources in the long term. Despite this, it is the most commonly used point in support of JavaScript.<\/p>\n<p>You can\u2019t just migrate a large JavaScript project to rigorous idiomatic TypeScript on the fly. Although there are some tools to assist, you\u2019ll still have to do most parts on your own.<\/p>\n<p>TypeScript code compilation takes time and CPU resources. There\u2019s also a waiting period for the code changes to appear in the browser. Unlike conventional JavaScript, real-time coding affects a little. On massive codebases, the tools also slow down significantly, causing significant latency in navigation, etc.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"When_should_you_migrate_your_project_to_TypeScript\"><\/span>When should you migrate your project to TypeScript?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When the code grows in size, complexity, and error proneness, it is preferable to identify specific problems during the compilation process. That\u2019s where TypeScript comes in handy.<\/p>\n<p>TypeScript also has interfaces and access modifiers that allow developers to collaborate and interact on a single codebase. Therefore, it\u2019s probably best to use TypeScript from the beginning of your project.<\/p>\n<p>However, if you prefer frameworks like Ember.js or Glimmer.js you\u2019ll have limited support for TypeScript. So JavaScript would be the language of choice for these frameworks.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Since TypeScript converts to ordinary JavaScript code, you could use it as an alternative to JavaScript. This is why it\u2019s gained in popularity. We\u2019ve also seen TS integrated into the core building components and libraries of the popular JS frameworks like Angular, React.js, and Vue.js.<\/p>\n<p>Personally, I\u2019m a fan of TypeScript and <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/general\/\" data-internallinksmanager029f6b8e52c=\"3\" title=\"General\" target=\"_blank\" rel=\"noopener\">general<\/a>ly recommend using it for new projects. A little more effort at the beginning to save a headache down the road makes a lot of sense to me.<\/p>\n<p>I hope that this article has helped you get a better understanding of the differences between these two scripting languages. At the very least, you\u2019ve got a better understanding of what exactly TypeScript is (if you didn\u2019t already know). Now you can make a more informed choice for your next project \ud83d\ude09\n                        <\/p><\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong>\n<\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/thenextweb.com\/news\/differences-between-javascript-and-typescript\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;The differences between Javascript and Typescript&#8221; This article was originally published on .cult by Piumi Gunawardhana. .cult is a Berlin-based community platform for developers. We write about all things career-related, make original documentaries and share heaps of other untold developer stories from around the world. In the beginning, there was JavaScript. The popular scripting language&#8230;<\/p>\n","protected":false},"author":1,"featured_media":418465,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/img-cdn.tnwcdn.com\/image\/tnw?filter_last=1&fit=1280,640&url=https:\/\/cdn0.tnwcdn.com\/wp-content\/blogs.dir\/1\/files\/2022\/03\/markus-spiske-iar-afB0QQw-unsplash.jpg&signature=7f1e3851b3da7106aecc281ffa1babd3","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-418464","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/418464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=418464"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/418464\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/418465"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=418464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=418464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=418464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}