Lesson contents

Calculate a total

Multiply the number of items by the price of one item to get the total.

Simple example

Start2 × 3
Result6
lesson.ts
console.log((2 * 3));
Output
6
Advertisements

Everyday examples

Three notebooks cost 4 each. What is the total?

Start3 × 4
Result12
lesson.ts
const notebooks: number = 3;
const price: number = 4;
console.log((notebooks * price));
Output
12
Run the example
Terminal
tsc --target ES2020 lesson.ts
node lesson.js
Official documentation