1JavaScript:
2function my_function(my_param) {
3 console.log('do something');
4}
5TypeScript:
6function my_function(my_param: any) {
7 console.log('do something');
8}
1TypeScript adds strict typing to JavaScript.
2It helps to reduce the number of errors in your code.
3
4Apart from strict typing, TypeScript introduces
5a plethora of features like Interfaces, Mixin classes, Enums
6and much more, as discussed later in the article.
1// What differs typescript from javascript is the strict usage of types.
2// Javascript is a loosely typed language,
3// while Typescript is strictly typed.
4
5// Javascript
6let car = 'BMW';
7let age = 15;
8
9// Typescript
10let car: string = 'BMW';
11let age: number = 15;
1They are really almost the same theres not the same param types like
2JAVASCRIPT is function myFunction(param)
3while typescript is
4function myFunction(the_param: something)