1

I have:

function _(x){
 return document.getElementById(x);
}

I would like to do the same think for getElementByClassName, but aside from "$" are there any other special characters I can use? I was thinking about may å or some accented character, but I don't know if it will work or not.

Is there any downside to doing something like this?

function å(x){
  return document.getElementByClassName(x);
}
Jacques ジャック
  • 3,682
  • 2
  • 20
  • 43

1 Answers1

3

In general the name of a function/variable must start with _, $ or a letter (even accented/with other diacritics)

Here they spoke at length of it: What characters are valid for JavaScript variable names?

Community
  • 1
  • 1
xanatos
  • 109,618
  • 12
  • 197
  • 280