var prototypes with a default value
I saw a solution from Stijn de Witt for definine enums in Javascript.

var SIZE = {

      SMALL : {value: 0, name: "Small", code: "S"},    
      MEDIUM: {value: 1, name: "Medium", code: "M"},    
      LARGE : {value: 2, name: "Large", code: "L"}
 
           };

Usage:
alert(SIZE.SMALL.value);
...

I have been trying to adapt this to allow me to define Users.

var RRR : {name: "RRRaney:, number: 2, date: 2007};

This works as I would expect:
alert(RRR.name + " " + RRR.date); //to display the text "RRRaney 2007". 

I would like to try to define the .name as the default,
so I could write something like:

alert(RRR + " " + RRR.date);      //to display the text "RRRaney 2007".
or just

alert(RRR);                      // to display the text "RRRaney".

Any Ideas?

Thanks<

Raney

var prototypes with a default value
===

I saw a solution from Stijn de Witt for definine enums in Javascript.

var SIZE = {

      SMALL : {value: 0, name: "Small", code: "S"},    
      MEDIUM: {value: 1, name: "Medium", code: "M"},    
      LARGE : {value: 2, name: "Large", code: "L"}
 
           };

Usage:
alert(SIZE.SMALL.value);
...

I have been trying to adapt this to allow me to define Users.

var RRR : {name: "RRRaney:, number: 2, date: 2007};

This works as I would expect:
alert(RRR.name + " " + RRR.date); //to display the text "RRRaney 2007". 

I would like to try to define the .name as the default,
so I could write something like:

alert(RRR + " " + RRR.date);      //to display the text "RRRaney 2007".
or just

alert(RRR);                      // to display the text "RRRaney".

Any Ideas?

Thanks<

Raney
