Home > Article > Web Front-end > The little secrets of JavaScript and its framework jQuery
Recently when I was doing front-end work in jQuery, I found that when applying ajax and passing its parameters, for example: url: "LoadAction?mark=load", in the LoadAction class, the mark received is an object. If you make a judgment, , then mark.equals("load") will successfully enter and determine success. If mark=="load" is applied, the judgment fails. In traditional JavaScript applications, on the contrary, the mark passed in is a variable.
Explain the difference between equals and ==. The former is generally used for comparison with objects, and the latter is used for comparison between constants and variables. The object value is the same but the address is different. It's just like a person's name. Maybe there are many people with the same name as you in China, but not one person. It can only be said that the names are the same. But the variable corresponds to an address. That is to say, although your name has changed, you are a person and your nature will not change. My understanding is rudimentary and I hope that any mistakes can be corrected. So as not to mislead others.