Random knowledge about Javascipt and Typescript

Created: Sep 17, 2018 | GA quality

Javascript is a programming language that is used primarily on the web. It is interpreted by web browsers in order to process and display data on web pages. Javascript is also known as ECMAScript, after the standard that encompasses a formal definition of the language.

In 2018, Javascript usage goes beyond the web itself and includes many so-called "backend" applications, written in frameworks such as Node.js. Many people learn Javascript as their first programming language, while working on websites and the web. Javascript is also known to be a somewhat frustrating language to work with, because it lacks certain features such as "static typing". One variation of Javascript that includes type information is called, appropriately, Typescript. Typescript was developed by engineers at Microsoft in order to create a version of Javascript that includes type information.

The "type" of a variable or function is basically the format of the information that it contains or returns. The number 123 is a "number" in this sense, whereas the letters "abc" are considered a "string". By assigning data types to your variables, you can automatically check whether or not you are passing the right "type" of thing into a function or method. So for example, what if you had a Person object that had a setName method? You wouldn't want to set the person's name to a number, or to an Array. You'd want to set it to a string. The Typescript compiler can let you know when you've accidentally tried to pass such nonsense to a function that doesn't accept it.



Comments

With an account on the Fediverse or Mastodon, you can respond to this post. Simply visit the post on its original server and leave your comment. It and other known non-private replies will be displayed below. Learn how this is implemented here and here.