JavaScript에서는 다음 예약어를 변수, 레이블 또는 함수 이름으로 사용할 수 없습니다.
| abstract | arguments | await* | boolean |
| break | byte | case | catch |
| char | class* | const | continue |
| debugger | default | delete | do |
| double | else | enum* | eval |
| export* | extends* | false | final |
| finally | float | for | function |
| goto | if | implements | import* |
| in | instanceof | int | interface |
| let* | long | native | new |
| null | package | private | protected |
| public | return | short | static |
| super* | switch | synchronized | this |
| throw | throws | transient | true |
| try | typeof | var | void |
| volatile | while | with | yield |
*로 표시된 단어는 ECMAScript 5 및 6의 새로운 단어입니다.
예약어 제거됨
다음 예약어는 ECMAScript 5/6 표준에서 제거되었습니다.
| abstract | boolean | byte | char |
| double | final | float | goto |
| int | long | native | short |
| synchronized | throws | transient | volatile |
이 단어를 변수로 사용하지 마십시오. ECMAScript 5/6은 모든 브라우저에서 완벽하게 지원되지 않습니다.
JavaScript 개체, 속성 및 메서드
또한 JavaScript 내장 개체, 속성 및 메서드의 이름을 사용하지 않아야 합니다.
| Array | Date | eval | function |
| hasOwnProperty | Infinity | isFinite | isNaN |
| isPrototypeOf | length | Math | NaN |
| name | Number | Object | prototype |
| String | toString | undefined | valueOf |
자바 예약어
JavaScript는 Java와 함께 사용되는 경우가 많습니다. 일부 Java 개체 및 속성을 JavaScript 식별자로 사용하지 않아야 합니다.| getClass | java | JavaArray | javaClass |
| JavaObject | JavaPackage |
기타 예약어
JavaScript는 많은 응용 프로그램에서 프로그래밍 언어로 사용될 수 있습니다.
또한 HTML 및 Window 객체와 속성의 이름을 사용하지 않아야 합니다.
| alert | all | anchor | anchors |
| area | assign | blur | button |
| checkbox | clearInterval | clearTimeout | clientInformation |
| close | closed | confirm | constructor |
| crypto | decodeURI | decodeURIComponent | defaultStatus |
| document | element | elements | embed |
| embeds | encodeURI | encodeURIComponent | escape |
| event | fileUpload | focus | form |
| forms | frame | innerHeight | innerWidth |
| layer | layers | link | location |
| mimeTypes | navigate | navigator | frames |
| frameRate | hidden | history | image |
| images | offscreenBuffering | open | opener |
| option | outerHeight | outerWidth | packages |
| pageXOffset | pageYOffset | parent | parseFloat |
| parseInt | password | pkcs11 | plugin |
| prompt | propertyIsEnum | radio | reset |
| screenX | screenY | scroll | secure |
| select | self | setInterval | setTimeout |
| status | submit | taint | text |
| textarea | top | unescape | untaint |
| window |
HTML 이벤트 핸들러
또한 모든 HTML 이벤트 핸들러의 이름을 사용하지 말아야 합니다.
예:
| onblur | onclick | onerror | onfocus |
| onkeydown | onkeypress | onkeyup | onmouseover |
| onload | onmouseup | onmousedown | onsubmit |
'웹 개발' 카테고리의 다른 글
| 자바스크립트 이름 규칙 Java script Naming Convention (0) | 2023.11.13 |
|---|