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?
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
Agree ? ( Y / N )
In computer programming, there is no magic.
It’s either a logic or an error.
— Lia Sue Kim from Deep Space
Agree ? (Y/ N)