If JavaScript will readily coerce between primitives and objects why adding properties to it results to undefined??
var a = \"abc\";
var b = a.length
console.log
Why don't you do it like this?
var abc=Number(3);
abc.foo="bar";
abc; //3
abc.foo; //bar
@Bergi indeed, sorry for this. I've missed the new statement. Here it is:
var abc=new Number(3);
abc.foo="bar";
abc; //3
abc.foo; //bar
At least it works just right. I don't know what else someone may need :) primitives... coercion... blah.