JavaScript language 11 and javascript language 11
Comparison between characters in JavaScript.
When learning the following content, Let's first look at the alert () function, which is a message prompt box.
OK. The following code is officially introduced:
<HTML><HEAD><TITLE>Hello World</TITLE></HEAD><BODY BGCOLOR="WHITE"><SCRIPT Language="JavaScript" TYPE="text/javascript">var value1="abc";var value2="abc";if(value1==value2){alert("value1=value2");}</SCRIPT></BODY></HTML>
After executing this code, the effect is as follows:
A message prompt box is displayed. When the content is value1 = value2, that is, the string value1 is equal to the string value2, and there are rules for comparing strings in JavaScript, compare two strings from left to right, that is, the first position of the first string and the first position of the second string, the second position of the first string is compared with the second position of the second string, and so on (JavaScript character comparison is case sensitive ).
To compare the size, perform the following in alphabetical order:
<HTML><HEAD><TITLE>Hello World</TITLE></HEAD><BODY BGCOLOR="WHITE"><SCRIPT Language="JavaScript" TYPE="text/javascript">var value1="abc";var value2="bca";if(value1<value2){alert("value1<value2");}</SCRIPT></BODY></HTML>
Obviously, the first position of the first string is followed by the second string B, so a <B.
Reprinted please indicate the source: http://blog.csdn.net/hai_qing_xu_kong/article/details/41286481 sentiment control _