2016-09-08 100 views
-6

我瞭解if條件如何工作。像這樣:反向if語句

if (condition) { 
    block of code to be executed if the condition is true 
} 

但是,如何反轉例如如果陳述是正確的,不要觸發這行代碼?

if $("span:contains('399')) { 
    block of code to be executed if the condition is false 
} 
+8

JavaScript的101 ...'如果(!條件){...}' –

+0

http://www.w3schools.com/js/js_if_else.asp – Dave

回答

0
if (!condition) { 
    block of code to be executed if the condition is false 
}