JS Coding Questions Logo
JS Coding Questions
#350💼 Interview💻 Code

What is the output of below console statement with unary operator

Advertisement

728x90

Let's take console statement with unary operator as given below,

javascript
1console.log(+"Hello"); // NaN

The output of the above console log statement returns NaN. Because the element is prefixed by the unary operator and the JavaScript interpreter will try to convert that element into a number type. Since the conversion fails, the value of the statement results in NaN value.

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 7

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
350of476
What is the output of below console statement with unary operator | JSCodingQuestions.com