Saturday, April 7, 2018

JavaScript - Reserved Keywrods

Saturday morning. Temperatures outside are near freezing and there's a chance of snow. I'm enjoying cinnamon coffee and an introductory course in JavaScript and jQuery.



Reserved words in JavaScript

Question: What reserved words are there in JavaScript?

Answer: Reserved words of the JavaScript language are listed below. (Some of these words are actually used in the Java language, and are reserved in JavaScript for compatibility purposes or as possible extensions.)

When choosing names for your JavaScript variables, avoid these reserved words!


abstract  else  instanceof  super  
boolean  enum  int  switch  
break  export  interface  synchronized  
byte  extends  let  this  
case  false  long  throw  
catch  final  native  throws  
char  finally  new  transient  
class  float  null  true  
const  for  package  try  
continue  function  private  typeof  
debugger  goto  protected  var  
default  if  public  void  
delete  implements  return  volatile  
do  import  short  while  
double  in  static  with 

In addition to the above reserved words, you'd better avoid the following identifiers as names of JavaScript variables. These are predefined names of implementation-dependent JavaScript objects, methods, or properties (and, arguably, some should have been reserved words):

alert  frames  outerHeight  
all  frameRate  outerWidth  
anchor  function  packages  
anchors  getClass  pageXOffset  
area  hasOwnProperty  pageYOffset  
Array  hidden  parent  
assign  history  parseFloat  
blur  image  parseInt  
button  images  password  
checkbox  Infinity  pkcs11  
clearInterval  isFinite  plugin  
clearTimeout  isNaN  prompt  
clientInformation  isPrototypeOf  propertyIsEnum  
close  java  prototype  
closed  JavaArray  radio  
confirm  JavaClass  reset  
constructor  JavaObject  screenX  
crypto  JavaPackage  screenY  
Date  innerHeight  scroll  
decodeURI  innerWidth  secure  
decodeURIComponent  layer  select  
defaultStatus  layers  self  
document  length  setInterval  
element  link  setTimeout  
elements  location  status  
embed  Math  String  
embeds  mimeTypes  submit  
encodeURI  name  taint  
encodeURIComponent  NaN  text  
escape  navigate  textarea  
eval  navigator  top  
event  Number  toString  
fileUpload  Object  undefined  
focus  offscreenBuffering  unescape  
form  open  untaint  
forms  opener  valueOf  
frame  option  window 

Similarly, the following names (depending on your target browser) may have special meanings as event handlers, and therefore should not be used for any other purpose:

onbeforeunload  ondragdrop  onkeyup  onmouseover  
onblur  onerror  onload  onmouseup  
ondragdrop  onfocus  onmousedown  onreset  
onclick  onkeydown  onmousemove  onsubmit  
oncontextmenu  onkeypress  onmouseout  onunload  

The above information was copied and pasted from:
Reserved Keywords in JavaScript

No comments:

Post a Comment

SQL

I've hit a wall in my SQL studies via the Khan Academy, and as such, I am engaging in additional studies prior to attempting to move for...