Today's Question:  What are you most afraid of as a programmer?        GIVE A SHOUT

Technical Article => Web =>  JavaScript

Some short code snippets which use all JavaScript keywords

  justjavac      2012-07-16 12:12:05      2,494    0    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

  SAVE AS PDF   MARK AS READ   MARK AS IMPORTANT

Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious

  RELATED


  0 COMMENT


No comment for this article.


  WRITE ARTICLE

Mr Bean is doing step by step debugging

By sonic0002