node js vs typescript code example
Example 1: typescript vs javascript
JavaScript:
function my_function(my_param) {
console.log('do something');
}
TypeScript:
function my_function(my_param: any) {
console.log('do something');
}
Example 2: 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;