I want to create a dictionary in javascript like this
var operations=
{
first: function(x)
{
return x[0];
}
}
How can I add the + operation as key to the dictionary that will point to the + operation in javascript? The same thing was done in python by operator.add . How can do it in Javascript?
var operations=
{
+ : return + operation in javascript //syntax is not valid
first: function(x)
{
return x[0];
}
}
.