You can't
Variable / Function names can only have Letters, Underscores, $, Numbers (if they're not the first character) along with a few other ACII, and unicode characters
Check here or here for more information
Workaroundish
If you are determined on having a +
as your function name, you could use:
window['+'] = function (a,b) {
return a+b;
};
That is bad practice and still only creates a variable "theoretically" named +
and can only be invoked using:
window['+'](9, 10);
Which returns 19
What you are thinking of
The syntax you are suggesting seems like Object.defineProperty
syntax:
Object.defineProperty(this, '+', {value:function () {
alert('foo');
}});
Try
You could create something like:
window.special = function(a, args) {
var o = {
'+': function (b,c) {
return b+c;
}
};
return o[a].apply(this, args);
};
Then:
special('+', [1, 2]);