Today's Question:  What does your personal desk look like?        GIVE A SHOUT

Some short code snippets which use all JavaScript keywords

  justjavac        2012-07-16 12:12:05       4,179        0    

In JavaScript, keywords are reserved and cannot be used as variable or function names. For example void, function and this are JavaScript keywords, they are keywords which are reserved for special use. Here is list of the keywords in JavaScript. We also show you some short code snippets which use all the keywords in JavaScript.

void function() {//abcd
  do break;while(typeof delete this);
  for(var a;;)
  if (true)  with(null)
  try{}catch(a){}finally{} else throw new 1;
 
  switch(1 in 1 instanceof 1) {
    case false:
    default:
  }
  return;
};

Here is an improved version:

new function() {
    do break;while(typeof delete this);
    for(var a;void 0;)
        continue
    if (null)
        with(0)
    try{
        switch(1 in 1 instanceof 1) {
            case false:
            default:throw true
        }
    }catch(a){}finally{}else return 
};

You can post your code snippet if you have a shorter one.

Source : http://justjavac.iteye.com/blog/1564713

JAVASCRIPT  KEYWORD  CODE SNIPPET 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  0 COMMENT


No comment for this article.