为什么Javascript不包含保留的关键字,例如"Object","Array","Function","Number" ...? [英] Why Javascript doesn't include reserved keywords such as "Object", "Array", "Function", "Number" ...?

查看:93
本文介绍了为什么Javascript不包含保留的关键字,例如"Object","Array","Function","Number" ...?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

某些特殊词,例如ObjectArrayFunctionMethodNumber等不属于Javascrpt中的关键字: JavaScript中的保留关键字.

Some SPECIAL words such as Object, Array, Function, Method, Number etc are not belong to keywords in Javascrpt: Reserved Keywords in Javascript.

但是我必须谨慎使用它们,它们不是objectarraymethodnumberfoo ...

But I have to use them carfully, they are not NORMAL words as object, array, method, number, foo ...

我想知道我们有多少个这样的特殊词?请把清单给我.

I'd like to know how many such SPECIAL words we have? Pls give me the list.

推荐答案

仅说明一下," function "是保留字," Function "是预定义对象在全球范围内.

Just to clarify, "function" is a reserved word, "Function" is a predefined object in the global scope.

您列出的特殊词(尽管我不确定"Method"吗?)是在全局范围内预定义的JavaScript类和对象.它们不一定是保留字,因为它们不是语言语法的一部分,在某些情况下可以被覆盖.但是,是的,通常不应该使用它们,否则应将它们与保留字"一样对待.另请参见全局属性和方法.

The special words you list (although I'm not sure about "Method"?) are predefined JavaScript Classes and Objects in the global scope. They aren't necessarily reserved words because they aren't part of the language syntax and can, in some cases, be overridden. But yes, ordinarily they should not be used and should otherwise be treated the same way as 'reserved words'. See also Global Properties and Methods.

编辑:参考开发人员中提供的列表. mozilla.org/zh-CN/JavaScript/Reference/Global_Objects -这似乎是 core JavaScript对象的列表,而不管浏览器中是否运行了JavaScript引擎.这是About.com提供的列表的子列表.虽然我不知道为什么从About.com的全局对象"列表中省略了布尔",但这确实是一个省略吗?

With reference to the list provided at developer.mozilla.org/en/JavaScript/Reference/Global_Objects - this appears to be a list of the core JavaScript Objects, irrespective of whether the JavaScript engine is running in the browser or not. This is a sub-list of the list provided at About.com. Although why 'Boolean' is omitted from the list of Global Objects at About.com I don't know - this does appear to be an omission?

(Mozilla)浏览器/DOM定义的其他对象在 Gecko DOM参考中列出

Other objects defined by the (Mozilla) browser/DOM are listed in the Gecko DOM Reference.

这篇关于为什么Javascript不包含保留的关键字,例如"Object","Array","Function","Number" ...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆