I am not able to figure it out if d is a global variable or because of (,) it will have a local scope like abc?
I think a , b and c have local scope and d is having a local scope.
function something(param) {
var a, b, c= {
someNumber: 7,
someObject: {},
},
d= {}
}
d
是局部的,因为逗号将其保留在var
语句中。
You can theorize all you want, but nothing beats solving it walking :
function something(param) {
var a, b, c= {
someNumber: 7,
someObject: {},
},
d= {}
}
something()
console.log(d);
produces:
ReferenceError: d is not defined
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.