You know JavaScript? Please answer, understand JavaScript?

Source: Internet
Author: User

You know JavaScript? Please answer, understand JavaScript?

Quick testing truly understands JavaScript core closures and out-of-scope. These five small scripts. Try to answer what is a reminder that it is not running on the console in every situation. Then you can create a test file to easily check your answers. Are you ready?

if (!("a" in window)) {    var a = 1;}alert(a);
var a = 1,    b = function a(x) {        x && a(--x);    };alert(a);
function a(x) {    return x * 2;}var a;alert(a);
function b(x, y, a) {    arguments[2] = 10;    alert(a);}b(1, 2, 3);
function a() {    alert(this);}a.call(null);


Do you understand javascript POST? Answer my questions if you understand.

You may need to write a script for specific implementation.

Var xhr = new XMLHttpRequest ();
Xhr. open ("POST", url, true );
/* The first parameter is the request method. Generally, the get and post methods are used, which is similar to the form label method.
The second parameter is the request URL.
The third parameter indicates whether the request is synchronous or asynchronous. true indicates asynchronous.
When the open method is called, only parameters are passed */
Xhr. onreadystatechange = function (){
If (xhr. readyState = 4 & xhr. status = 200 ){
Alert (xhr. responseText );
}
};

Xhr. setRequestHeader ("Content-Type", "application/x-www-form-urlencoded ");

Xhr. send (parameter); // After the send method is called, the request parameters are changed to the "source code" you wrote last"

Understanding javascript

The compilation cannot be stopped. All html files must be parsed by the browser after being generated, and JavaScript files are also used. In this way, all contents have been run. If you do not want to display them, javascript can obtain the html content and hide it with the display: none attribute.
Or, after reading the specified content, set its innerHTML = ""
As for how to obtain it, you can identify the content by ID

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.