Skip to content
Advertisement

if else Conditions

The problem is like this

My solution:

JavaScript

Now, if I enter 18 then it should be printed "Weird". But it is showing "Not Weird".

I am not getting where the problem of my code is.

Advertisement

Answer

The operator & is the bitwise and operation. You need logical AND, instead, and it is done by means of and keyword.

Just replace & with and:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement