multiply two numbers in typescript

To multiply two numbers in TypeScript, you can simply use the multiplication operator *. Here's an example code snippet:

index.ts
let num1: number = 5;
let num2: number = 10;
let result: number = num1 * num2;
console.log(result); // Output: 50
114 chars
5 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