123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|599|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Web Development -> Is # ever used in JavaScript?

Wed, 23 Jun 2010, 11:00
JL235
Quick question, and googling doesn't seem to answer this. Does the hash symbol (#) have any special meaning, anywhere, in JavaScript?

I'm presuming (and hoping) it's a complete no, but just want to check.

Thanks.
Wed, 23 Jun 2010, 11:13
shroom_monk
I've never seen it used, and my Javascript book doesn't have any reference to it in the index at all, so I think you're safe to use it.

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Thu, 24 Jun 2010, 16:36
JL235
thanks
Thu, 24 Jun 2010, 17:00
CodersRule

Running this gives me the error:

Error: illegal character
Source File: jstest.html
Line: 2
Source Code:
#();


So I assume you're not allowed to use it?
Thu, 24 Jun 2010, 17:18
JL235
I was wondering if it might be used for something else. For example @ is used for the pre-processor in JScript.
Thu, 24 Jun 2010, 19:02
Stealth
You can't have a # be a variable, like most languages.

You really should stick with letters, numbers, and underscores.

-=-=-
Quit posting and try Google.
Fri, 25 Jun 2010, 02:47
JL235
I don't want to use it for variable names.
Sun, 27 Jun 2010, 17:43
mindstorm8191
JL, what did you have in mind for the # symbols?
Sun, 27 Jun 2010, 18:03
HoboBen
Considering the wide-spread usage of shebangs/hashbangs, I'd be tempted to say - being unable to find any evidence to the contrary - that they are fairly safe to use outside of this case. I couldn't find any mention of them in reserved symbols.

-=-=-
blog | work | code | more code