I was experimenting with some javascript when I came across a syntax error. I was trying to assign an object key with a value that is returned from a method.
var a = new function(){
    this.b = function()
    {
        return "c";
    }
};
var myobj = {
   a.b:"d" //Syntax error, unexpected '.'
};
The above will throw an error; but then javascript will allow:
var n = a.b;
var myobj = {
   n:"d" //no error
};
Even though typeof a.b and typeof n returns both the same as function?
 
     
    