Code:

Angle=function(n){
var x=new Number(n);
var mod=0;//mod=0--> degree mod=1-->radian
x.toString=function (){return x;}
x.valueOf=function (){return Number.prototype.valueOf.apply(x);}
x.toFixed=function (){return Number.prototype.toFixed.apply(x,arguments);}
x.toPrecision=function (){return Number.prototype.toPrecision.apply(x,arguments);}
x.toExponential=function (){return Number.prototype.toExponential.apply(x,arguments);}
x.degree = function(v) {if(v!=null){x=v;mod=0;}else{ return mod==0?x:x*(180/Math.PI);}}
x.radian = function(v) {if(v!=null){x=v;mod=1;}else return mod==1?x:x*(Math.PI/180);};
return x;}
var y=Angle(30);//enter 30 degree
alert(y.degree()+" degree= "+y.radian()+" radian");
y.degree(90);
alert(y.degree()+" degree= "+y.radian()+" radian");
y.radian(0.2);
alert(y);
y.radian(25.6);
alert(y.toFixed());
alert("Y is "+(y.mod==0?"degree ":"radian ")+"= "+y);
alert(y.degree()+" degree= "+y.radian()+" radian");