Javascript
Apr 25, 2026
What does this print?
let x = "5"
let y = 3
console.log(x - y)
Explanation
The minus sign (-) always converts strings to numbers before doing math. So "5" becomes 5, and 5 minus 3 equals 2. Only the plus sign (+) causes string joining — every other math operator forces number conversion.
📝
Reviewed by CodeShot Editorial
Every challenge is code-reviewed by senior developers to ensure accuracy and real-world relevance. Learn more.