Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use `µ` as a JavaScript variable name? [duplicate]

Tags:

javascript

Possible Duplicate:
Valid Characters for JavaScript Variable Names

I know that the ECMAScript specification says I can use µ (Greek lowercase Mu), and I have tested on a couple of browsers, but is it rock solid? Will it work with all browsers? What could be the pitfalls?

Technically I don't expect it is any different than jQuery using $ as a variable name - is there a technical difference?

like image 239
Billy Moon Avatar asked Feb 03 '26 13:02

Billy Moon


1 Answers

Yes, you can use it.

In example:

var π = Math.PI;

as well as Unicode escape sequences.

Basically, the variable in JavaScript can be anything that's valid according to ECMAScript 5.1 and Unicode 6.1.

Here is some online JavaScript variable name validator.

For the references, this page is for documenting the differences between ES5 specification and the requirements for ECMAScript implementations in web browsers.

like image 126
kenorb Avatar answered Feb 06 '26 03:02

kenorb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!