About function parameters

Let's look at a chestnut first:

function buildUrl() {
    var qs = "?debug=true";

    with(location){
        var url = href + qs;
        console.log(location) ;
    }

    return url;

}

var result = buildUrl();
alert(result);

 

The with statement receives the location object, so its variable object contains all the properties and methods of the location object.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325986931&siteId=291194637