Did you know that Javascript allows variable names in 中文?

Post date: Mar 16, 2011 4:26:43 AM

For instance, this is perfectly valid JavaScript. [In Mozilla Firefox --  see below]

function 试验(数字){ //computes factorials. testing JavaScript's Unicode variables support.

    if(数字<=1){

        return 1;

    }

    else{

        return 试验(数字-1) * 数字;

    }

}

Edit: Ironically, if you open this post, you'll see that Google Sites does not allow Chinese characters in the URL. They are allowed in the title. weird.

Edit 2: Google Chrome's V8 JavaScript Engine seem to hate Chinese characters in variable names. Since JavaScript was first implemented for Netscape, the ancestor of Firefox, I'm going to say that it's Chrome's fault.