There are some differences.
, :
function () {
var location = { 'href' : '123' } ;
console.log(window.location.href)
console.log(location.href)
}
, , , location. , , . , :
function () {
var window = { 'location' : { 'href': '123' } };
console.log(window.location.href)
console.log(location.href)
}
, , , , , , , , var, .