js and typescript code example
Example 1: what is typescript
Basically, TypeScript is like an extension or "superset" of JavaScript.
Since JavaScript is a loosely typed language,
TypeScript enforces the strict use of types.
Thus, making it a strictly typed language.
Example 2: typescript vs javascript
They are really almost the same theres not the same param types like
JAVASCRIPT is function myFunction(param)
while typescript is
function myFunction(the_param: something)
Example 3: typescript vs javascript
// What differs typescript from javascript is the strict usage of types.
// Javascript is a loosely typed language,
// while Typescript is strictly typed.
// Javascript
let car = 'BMW';
let age = 15;
// Typescript
let car: string = 'BMW';
let age: number = 15;