JavaScript Learning Primer 1th/3 Page _ Basics

Source: Internet
Author: User
<Html>
<Head>
<Meta HTTP-Equiv="Content-type"Content="text/html;charset=gb2312">
<Title>Document.writeln () method</Title>
<Script language="Javascript">
functionCreatesummary ()
{
Win2=Open"","Window2")
//Win2.document.open ("Text/plain")
Win2.document.writeln ("Title"+Document.title)
Win2.document.close ()
}
</Script>
</Head>
body a name
= " #top " ></ a
     form         Input type = " button "  name = ' help '  value = ' help ' OnClick = createsummary () ""
     </ form
"" </
HTML

Tell me about the essentials of knowledge:

1:javascript is a case-sensitive language.

2: It is recommended to use '; ' for each writing line.

3: The name of the first letter must be a letter, underscore or ' $ ';

4: Declare the variable in JavaScript with Var, and it is permanent;

5: There is no block-level scope. For example:

Var scope="globle";
function F () {
alert (scope); // show "underfined" instead of "globle"
Var scope="local";
alert (scope);
}
F ();
Same meaning as the following code instance
Var scope="globle";
function f () {
Var scope;
alert (scope); // show "underfined" instead of "globle"
Var scope="local";
alert (scope);
}
F ();

Recommendation: It is a good programming practice to put all the variable declarations together and place them at the beginning of the function.

The 6:ecmascript standard stipulates that functions cannot be overloaded, such as

function Doadd (i) {
alert (i);
}

function Doadd (i) {
alert (i);
}
Doadd (ten);

What really executes is the latter function, and the second one overrides the first function;

The use of 7:arguments objects.

function Doadd ()
If (arguments.length= =1) {
Alert (arguments[0]+);
}

If (arguments.length= =2) {
Alert (arguments[0]+arguments[0);
}

Doadd (ten);
Doadd (a);

Operation effect: Slightly ...

Current 1/3 page 123 Next read the full text

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.