print hello world in typescript

To print "Hello, World!" in TypeScript, you can use the console.log() function. The syntax is:

index.ts
console.log("Hello, World!");
30 chars
2 lines

Make sure to save the file with a .ts extension, then compile it using the TypeScript compiler. You can do this by running the following command in your terminal:

index.ts
tsc filename.ts
16 chars
2 lines

This will generate a JavaScript file with the same name as your TypeScript file. You can then run the JavaScript file using Node.js or include it in your HTML file as a script.

gistlibby LogSnag