To print "Hello, World!" in TypeScript, you can use the console.log()
function. The syntax is:
index.ts30 chars2 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.ts16 chars2 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