JavaScript 保留关键字

介绍

有某些关键字,你不能在JavaScript中使用。下面你会找到所有保留的关键字的列表。

前提条件

在 JavaScript 中保留关键字

以下是你不能在JavaScript中使用变量名称和标识符的关键字:

await, break, case, catch, class, const, continue, debugger, default, delete, do, else, enum, export, extends, false, finally, for, function, if, implements, import, in, instanceof, interface, new, null, package, private, protected, public, return, super, switch, this, throw, true, try, typeof, var, void, while, with, yield

您还应该避免这些 HTML 事件处理器作为标识符:

onblur, onclick, onerror, onfocus, onkeydown, onkeypress, onkeyup, onmouseover, onload, onmouseup, onmousedown, onsubmit

结论

保留的关键字是JavaScript的一个重要元素. 有关编程语言的更全面的概述,请访问我们的教程系列, How To Code in Javascript

Published At
Categories with 技术
Tagged with
comments powered by Disqus