What is TypeScript? TypeScript vs JavaScript for Development
JavaScript is considered a weakly typed language. In this lesson, we'll go through a simple example of why that can be an issue in development and where TypeScript falls in the picture.
📝 This lesson's quiz can be found -
.
🗒️ Solutions for this lesson's quiz can be found -
.
JavaScript is considered a weakly typed language which means that in JavaScript, we have the ability to assign one data type to a variable and later on assign another data type to that same variable.
Let's see an example of this in our index.js
file. We'll look to replicate what we've done before by creating two variables, one
and two
, and attempt to show the summation of these two variables.
In the src/index.js
of our server project, we'll create constant variables labeled one
and two
and provide numerical values of 1
and 2
respectively.
xxxxxxxxxx
const one = 1;
const two = 2;
In the callback function of our app.get()
method for the index route, we'll send an interpolated string that says 1
plus 2
is equal to the sum of the variables one
and two
.
xxxxxxxxxx
app.get("/", (req, res) => res.send(`1 + 2 = ${one + two}`));
When we launch our app in http://localhost:9000/, we'll see an output of 1 + 2 = 3.

This lesson preview is part of the TinyHouse: A Fullstack React Masterclass with TypeScript and GraphQL course and can be unlocked immediately with a single-time purchase. Already have access to this course? Log in here.
Get unlimited access to TinyHouse: A Fullstack React Masterclass with TypeScript and GraphQL with a single-time purchase.
