0

document.write((4 < 2)!(10 >15));

above code is returning uncaught syntax error , why this, I am trying to check boolean operator not

8th Feb 2017, 7:48 PM
ASHISH PANDEY
ASHISH PANDEY - avatar
6 Respuestas
+ 6
The boolean operator not take only one argument... you try to use it with two ^^ !false is true !true is false ... but your (4<2)!(10>5) stand for false!true, and javascript interpreter don't know how to handle it: and you? :P
8th Feb 2017, 7:53 PM
visph
visph - avatar
+ 3
Not just like '&&': 'and' ( '&&' ) is a binary boolean operator, while 'not' ( '!' ) is a unary boolean operator... Meanning you can write ( a && b ), but you cannot ( a ! b), just ( !a ) and/or ( !b ). Try to say it as human language: if a and b... sound logical, but: if a not b don't ( while: if not a, and/or: if not b are )
8th Feb 2017, 8:16 PM
visph
visph - avatar
0
and what ! is supposed to mean?
8th Feb 2017, 7:53 PM
Zilvinas Steckevicius
Zilvinas Steckevicius - avatar
0
maybe you want to use " != ", try with (4<2)!=(10>15)
8th Feb 2017, 7:54 PM
Manuel García Montes
Manuel García Montes - avatar
0
! mean not a logical operator
8th Feb 2017, 7:55 PM
ASHISH PANDEY
ASHISH PANDEY - avatar
0
"!" is a " boolean logical operator just like "&&"
8th Feb 2017, 7:57 PM
ASHISH PANDEY
ASHISH PANDEY - avatar