An example of a semicolon crash in js

  • 2020-03-27 00:07:31
  • OfStack

if ($("span", $("#txtStere").siblings("div")).text() === "*"); 
if (!IsNum("#txtStere")) { 
$("#txtStere").next().text(" The freight template you choose is calculated by volume. The logistics volume cannot be empty and needs to be a number "); 
return false; 
} else { 

The above js code no matter if the result of the condition is true or false will execute the code of curly braces, I worked for more than an hour, in a daze is not understand what is going on, crash ah crash, finally the devil found the reason, if the condition bracket after the semicolon, there is no, crash!

Related articles: