<script>
// 给 Object 对象添加新方法 showValue
Object.prototype.showValue = function (){
// alert(this.valueOf());
return this.valueOf();
};
var str = "Hello World" ;
var num = 23 ;
var ss = str.showValue();
num.showValue();
alert(ss);
// 改变 toString 的原意
var str = "123";
alert(str.toString());
String.prototype.toString = function(){
return "Function code hidden !"
}
alert(str.toString());
</script>
运行后的结果: