简体   繁体   English

Node.js JavaScript数据类型

[英]Node.js JavaScript Datatype

Am learning Node.js. 正在学习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. 您正在查看的是嵌套的javascript对象及其使用方式。 The image attached is in Chrome's console and accessing each key of the object. 附件中的图片位于Chrome的控制台中,可以访问对象的每个key So initially the object is assigned to x . 因此,最初将对象分配给x Inside of x there's a key of a . 里面的x有一个关键的a xa is also an object with a key of n which has the value of 0 assigned to it. xa也是一个键为n的对象,键的n值为0 So xan === 0 . 所以xan === 0 Objects can have multiple data types and are used very often in javascript. 对象可以具有多种数据类型,并且在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. 您正在查看的是嵌套的javascript对象及其使用方式。 The image attached is in Chrome's console and accessing each key of the object. 附件中的图片位于Chrome的控制台中,可以访问对象的每个键。 So initially the object is assigned to x. 因此,最初将对象分配给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. 在x的内部,有一个axa的键也是一个对象,该对象的键为n,其值为0。 So xan === 0. Objects can have multiple data types and are used very often in javascript. 因此xan ===0。对象可以具有多种数据类型,并且在javascript中经常使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM