Home  >  Article  >  Web Front-end  >  A debugging problem caused by JS semicolon_javascript skills

A debugging problem caused by JS semicolon_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:51:35888browse

Look at the following code:
var a=textbox1.text;
var b=5;
if(a{
a=b;
}
Look at the effect after execution. No matter what the value of textbox1.text is, the condition will be judged. Why? Have you found anything?
It turns out that when I was writing the code, there was an extra semicolon here in if(aNote: What I just wrote down, When I opened it again, there was no content. So I simplified it a bit. I wrote a general meaning

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn