JavaScript language 11 and javascript language 11

Source: Internet
Author: User

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 _





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.