ホーム > javascript > JavaScript 予約語
JavaScript 予約語
JavaScriptリファレンス

予約語とは
予約語 は、JavaScript が使用するキーワードであり、これらのワードは特別な意味を持っています。そのため、プログラムの識別子(変数名、関数名、メソッド名、オブジェクト名など)として使用することが出来ないワードです。例えば、変数を new という識別子で作成したとします。new は予約語です。
1 2 | var new = "新しい"; document.write(new); |
実行すると、 SyntaxError: Unexpected token new という構文エラーが発生します。予約語 は 識別子 として使用できないとうことです。token(トークン)。
また、予約語 は小文字で記述します。JavaScript では 大文字 と 小文字 を区別します。
予約語の仕様
予約語は、ECMAScript(エクマスクリプト) の仕様で決められています。
予約語 ECMAScript 7 (2016)
ECMAScript 7(ECMA-262 7.0 Edition の11.6.2.1)(2016年版)
予約語
| break | void | switch |
| do | class | yield |
| in | extends | debugger |
| typeof | return | function |
| case | while | this |
| else | const | default |
| instanceof | finally | if |
| var | super | throw |
| catch | with | delete |
| export | continue | import |
| new | for | try |
将来的に言語拡張で使用される予約語
| implements | package | protected |
| interface | private | public |
厳格モードで将来的に使用される予約語
| enum | await |
予約語 ECMAScript 6 (2015)
ECMAScript 6(ECMA-262 6.0 Edition の11.6.2.1)(2015年版)
予約語
| break | export | super |
| case | extends | switch |
| catch | finally | this |
| class | for | throw |
| const | function | try |
| continue | if | typeof |
| debugger | import | var |
| default | in | void |
| delete | instanceof | while |
| do | new | with |
| else | return | yield |
将来的に言語拡張で使用される予約語
| implements | package | protected |
| interface | private | public |
厳格モードで将来的に使用される予約語
| enum | await |
予約語 ECMAScript 5.1 (2011)
ECMAScript 5(ECMA-262 5.1 Edition の7.6.1.1)(2011年版)
予約語
| break | finally | this |
| case | for | throw |
| catch | function | try |
| continue | if | typeof |
| debugger | in | var |
| default | instanceof | void |
| delete | new | while |
| do | return | with |
| else | switch |
将来的に言語拡張で使用される予約語
| class | export | super |
| const | extends | |
| enum | import |
厳格モードで将来的に使用される予約語
| implements | package | public |
| interface | private | static |
| let | protected | yield |
使用を避けた方が良い識別子
JavaScript のオブジェクト名、プロパティ名、メソッド名
JavaScript に組み込まれたオブジェクト名、プロパティ名、メソッド名の使用は避けましょう。
| Array | String | Number |
| Infinity | eval | undefined |
| Math | isNaN | hasOwnProperty |
| prototype | name | length |
| Date | toString | Object |
| isFinite | function | valueOf |
| NaN | isPrototypeOf |
JavaScript のグローバル変数やグローバル関数
以下のワードは、グローバル変数やグローバル関数として定義されている識別子です。以下の名前の識別子は避けるべきでしょう。
| arguments | EvalError | RangeError |
| Array | Infinity | ReferenceError |
| Boolean | isFinite | Number |
| Date | isNaN | String |
| decodeURI | Math | SyntaxError |
| decodeURIComponent | NaN | TypeError |
| encodeURI | Function | undefined |
| Error | Object | unescape |
| escape | parseFloat | RegExpURIError |
| eval | parseInt |
Windows の予約語
JavaScript は HTML 以外でも、多くのアプロケーションプログラムで使用することが可能です。Windows の予約語なども避ける方が無難です。
| alert | password | frame |
| assign | radio | link |
| clearTimeout | secure | frames |
| constructor | status | images |
| document | top | outerHeight |
| encodeURI | anchor | parent |
| focus | button | plugin |
| innerWidth | close | screenX |
| mimeTypes | decodeURI | self |
| hidden | elements | taint |
| open | escape | untaint |
| packages | forms | area |
| parseInt | layers | clearInterval |
| propertyIsEnum | navigator | confirm |
| scroll | image | defaultStatus |
| setTimeout | option | embeds |
| textarea | pageYOffset | fileUpload |
| all | pkcs11 | innerHeight |
| blur | reset | location |
| clientInformation | select | frameRate |
| crypto | submit | offscreenBuffering |
| element | unescape | outerWidth |
| encodeURIComponent | anchors | parseFloat |
| form | checkbox | prompt |
| layer | closed | screenY |
| navigate | decodeURIComponent | setInterval |
| history | embed | text |
| opener | event | window |
| pageXOffset |
タグ(=記事関連ワード)
タグ: JavaScript, 予約語
日付
投稿日:2018年6月12日
最終更新日:2018年06月13日
最終更新日:2018年06月13日
このカテゴリの他のページ
この記事へのコメント
トラックバックurl
https://wepicks.net/jsref-reserved_word/trackback/



