m0therway m0therway - 3 months ago 22
Javascript Question

JS variable starting with "@"

I've come across someone's old code that has variables identified like: @user_id@, @reference_id@, and so forth. Wikipedia says "In certain JavaScript implementations, the at sign (@) can be used in an identifier..." In what JS implementations does this work? I can't get it to work.

Answer

This is totally valid:

var π = Math.PI;

This does not appear to be valid:

var @yourName = "Jamund";

This works though:

var $yourName = "Jamund";

If you're bored and want to learn all of the gory details: http://mathiasbynens.be/notes/javascript-identifiers

As for your specific problem, yeah it's probably either in a comment (JavaDoc uses @ in its comments and sometimes it's style has been used in JS comments) or it was meant to be processed and replaced server-side.