JavaScript Unary Operators: Unpacking console.log(2 - - 3);

Published: 13 June 2024
on channel: Proto Coders Point
878
36

console.log(2 - - 3);. 💻🔍

At first glance, this code snippet might seem confusing, but it's actually quite simple:

The expression uses the unary negation operator -.
The double negative turns -3 into +3.
Therefore, 2 - -3 becomes 2 + 3, which results in 5!

Watch this tutorial to see how it works and gain a deeper understanding of unary operators in JavaScript. Elevate your coding skills with this quick and insightful explanation!

#TechTutorial #UnaryOperator #LearnToCode #WebDevelopment


Watch video JavaScript Unary Operators: Unpacking console.log(2 - - 3); online, duration hours minute second in high quality that is uploaded to the channel Proto Coders Point 13 June 2024. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 878 times and liked it 36 visitors.