To multiply two numbers in TypeScript, you can simply use the multiplication operator *
. Here's an example code snippet:
index.ts114 chars5 lines
In the above code, we declare two variables num1
and num2
of type number
and initialize them with the values 5 and 10 respectively. We then declare another variable result
and assign the previous two variables multiplied together to it. Finally, we output the result to the console.
gistlibby LogSnag