Загрузка...

TypeScript Tutorials - 03 First Program in TypeScript

"First Program in TypeScript" In this lesson, I am going to discuss how to write our first program in TypeScript. I have got "tsproject" project folder on the desktop, which does not contain anything as of now. I will drag this folder to the Visual Studio Code. In this folder, I will create TypeScript file. Remember that typescript file should contain "ts" extension. Let's create a "firstprogram.ts" file, wherein I will write "Hello World" Program. I have used two ways to show "Hello World" message. In the first method, I just wrote a simple function that prints "Hello World" message inside the Console.log(). In the second method, I have passed a message to the function. In order to compile the TypeScript code, w need to write following command on Command Prompt: tsc firstprogram.ts When you execute the program, it generates firstprogram.js (javascript) file for us. If there will be an error, it will show us an error. Now, we can execute the javascript file with the following command: node firstprogram.js While watching code of both files, you will notice that they contain same code. That is absolutely correct. This is because JavaScript code is a valid TypeScript code. When you compile TypeScript, it generates corresponding JavaScript code for us, which you can further execute on your browser. However, TypeScript gives a lot of features, which I will discuss in future lessons. https://youtu.be/k-we8VesHFo ********************************************************************* Please subscribe to my channel: https://www.youtube.com/c/ashmanmalhotra?sub_confirmation=1 ********************************************************************* Thank you for watching my video on "TypeScript Introduction" ********************************************************************* Contact: training@ashman.in for training inquiries ********************************************************************* "TypeScript Programming Basics" | "TypeScript Introduction" | "First program in TypeScript" | “Compiling TypeScript”

Видео TypeScript Tutorials - 03 First Program in TypeScript автора Полное руководство по JavaScript
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки