Notes and some basic syntaxes during JavaScript usage

Source: Internet
Author: User

1. Implement a hyperlink in Javacsript: <a href = "javascript ('hello')> point </a>

2. function calls in JavaScript can be performed before function declaration.
3. JavaScript does not require that all paths have return values as in C #. If no return value exists, undefined is returned.
Anonymous functions:
Copy codeThe Code is as follows:
Var f1 = function (i1, i2) {return i1 + i2 };
Alert (f1 (10, 12 ));
Alert (function (i1, i2) {return i1 + i2} (10, 12 ));

4. There is no namespace concept in Javascript. The functions with the same name in the two js files are referenced at last or declared at last.
When referencing an external js file: cannot <script src = "... "Type =" text/javascript "/>, which must be written as <script src = "... "Type =" text/javascript "> </script>

5. There is no class syntax in Javascript, Which is simulated by function closures.

6. arrays in JS are not only common arrays, but can also be used as Dictionary and Stack.

Copy codeThe Code is as follows:
Var array = new Array ();
Array ["persons"] = "ren ";
Array ["Port"] = "kou ";
Array ["hand"] = "shou"

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.