Am learning Node.js. Could anyone explain what does this mean? What data type is this one and how is it useful?
var x = { a = { n: 0 } };
I think what you're trying to learn is how an object works.
The question you asked actually has some bad syntax and should be re-written like this.
let x = {
a: {
n: 0
}
}
What you're looking at is a nested javascript object and how it's used. The image attached is in Chrome's console and accessing each key
of the object. So initially the object is assigned to x
. Inside of x
there's a key of a
. xa
is also an object with a key of n
which has the value of 0
assigned to it. So xan === 0
. Objects can have multiple data types and are used very often in javascript.
I think what you're trying to learn is how an object works.
The question you asked actually has some bad syntax and should be re-written like this.
let x = {
a: {
n: 0
}
}
enter image description here
What you're looking at is a nested javascript object and how it's used. The image attached is in Chrome's console and accessing each key of the object. So initially the object is assigned to x. Inside of x there's a key of axa is also an object with a key of n which has the value of 0 assigned to it. So xan === 0. Objects can have multiple data types and are used very often in javascript.
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.