Subtraction JavaScript
Arithmetic Operators — Subtraction
Math involves both, numbers & operations. Operations tell us what to do with the numbers.
Subtract a number from another with JavaScript
What is subtraction?
Get Firdavsi Web Dev’s stories in your inbox
Join Medium for free to get updates from this writer.
To subtract numbers means to take away a number from another.
JavaScript uses the minus sign (-) as subtraction operator when placed in between two numbers. Let’s see it in code.
const difference = 7 - 5;
console.log(difference);Here everything to the right side of equal sign is evaluated first or it first does the math 7–5 = 2
Then the result or difference 2 is being stored to the variable difference.
That’s why when you log the variable difference to the console, you’ll get the result which is 2 but not 7–5







