Loading...

JavaScript Weirdness: "5" + - "2" Explained! | Type Coercion & Unary Operators

432 0________

What Happens When You Run "5" + - "2" in JavaScript? 🤔 🔹

JavaScript is full of unexpected behaviors, especially when it comes to type coercion and operators. In this video, we’ll break down:

Why "5" + - "2" results in "5-2" instead of a number

How JavaScript treats + and - with strings and numbers

How the unary minus (-) operator affects string conversion

Common JavaScript interview questions on type coercion

🎯 What You’ll Learn:

✅ How JavaScript handles type conversion in arithmetic
✅ Why + triggers string concatenation while - converts to numbers
✅ How the unary minus (-) operator works in JavaScript
✅ JavaScript interview tricks & concepts

🔥 Master JavaScript quirks one step at a time! Subscribe for more JS tricks & interview questions!

#JavaScript #QuizifyCoder #javascriptalgorithmchallenges
#javascriptlogicbuildingquestions
#javascriptlogicalinterviewquestions
#javascriptinterviewquestionsandanswers #JSInterviewQuestions #WebDevelopment #JavaScriptTricks

コメント