根据 Professional Javascript for Web developers array is not a datatype in Javascript:
❑ “undefined” if the value is undefined
❑ “boolean” if the value is a Boolean
❑ “string” if the value is a string
❑ “number” if the value is a number
❑ “object” if the value is an object or null
❑ “function” if the value is a function
对吗?
最佳答案
这是正确的,Array只是 object
的后代。请注意,尽管它确实覆盖了一些东西,例如数组中的 .toString()
将其成员打印在逗号列表中,而不是像 "[Object object]"
普通对象会。
关于javascript - 数组不是 Javascript 中的数据类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4148258/