JavaScript Reserved KeyWords are part of the JavaScript language syntax. JavaScript Reserved KeyWords has special meanings and used to instruct JavaScript interpreter to perform a specific pre define task. JavaScript has some reserved keywords which can not be used as an identifier. Using JavaScript Reserved KeyWords as an identifier for variable names, function names, and loop labels results in error.
Table 1 -JavaScript 1.5 Reserved KeyWords | ||||
abstract | boolean | break | byte | case |
catch | char | class | const | delete |
debugger | default | delete | do | double |
else | enum | export | extends | false |
final | finally | float | for | function |
goto | if | implements | import | in |
instanceof | int | interface | long | native |
new | null | package | private | protected |
public | return | short | static | super |
switch | synchronized | this | throw | throws |
transient | true | try | typeof | val |
var | void | volatile | while | with |
Apart from the keyword listed above, there are some reserved keywords. There other words that may have problems under some versions of JavaScript. These keywords are not currently used in JavaScript, but they are reserved by ECMAScript as possible future extensions to the language. Try to avoid there words as a veriable.
Table 2 -JavaScript Potentially Reserved Words | ||||
As | Assert | Decimal | Ensure | Exclude |
event | get | include | internal | invariant |
Is | Namespace | Require | Sbyte | Set |
uint | ulong | use | ushort |
This list not end here, we are using JavaScript as a Client side scripting language. Mostly we use JavaScript with Server Side Scripting languages like ASP, ASP.NET and PHP. To maintain good compatibility there are some words which we should avoid to use as an identifiers. They are…
Table 3 – Words should avoid to use as an identifier | ||||
arguments | Array | Boolean | Date | decodeURI |
decodeURIComponent | encodeURI | Error | escape | eval |
EvalError | Function | Infinity | isFinite | isNaN |
Math | NaN | Number | Object | parseFloat |
parseInt | RangeError | ReferenceError | RegExp | String |
SyntaxError | TypeError | undefined | unescape | URIError |
No comments:
Post a Comment