Mathematical operations such as addition, subtraction, multiplication, and division are commonly used in JavaScript.
let a = 10, b = 5;
let sum = a + b; // Addition
let difference = a - b; // Subtraction
let product = a * b; // Multiplication
let quotient = a / b; // Division
let modulus = a % b; // Modulus (remainder)
let power = a ** b; // Exponentiation
console.log(sum); // 15
console.log(difference); // 5
console.log(product); // 50
console.log(quotient); // 2
console.log(modulus); // 0
console.log(power); // 100000
Explanation:
- Mathematical operations like addition (
+
), subtraction (-
), multiplication (*
), division (/
), modulus (%
), and exponentiation (**
) are used.
No comments:
Post a Comment