Check if value is not greater / less than zero - Javascript | |||||||||||
How to check if value is not greater or less than zero using Javascript ? I tried to use the following solution for "not greater than zero" condition, but it is not working. if ( !value>0 && otherValue==1 ) { alert('Ok'); } | |||||||||||
| |||||||||||
Hi, To make the "is not greater than zero" condition work correctly in javascript, you have to add brackets (parentheses) there. The code with logical NOT operator used, should look like: if ( !(value>0) && otherValue==1 ) { alert('Ok'); } | |||||||||||
| |||||||||||
| |||||||||||
![]() ![]() ![]() ![]() | |||||||||||
2022 AnswerTabs | Terms | Contact us |