JavaScript Math toSource() 方法
定义和用法
toSource() 方法返回表示对象源代码的字符串。
注意: 该特性是非标准的,请尽量不要在生产环境中使用它!
语法
object.toSource()
提示和注释
注释:该方法在 Internet Explorer 中无效。
实例
下面的例子向您展示 toSource() 方法的用法:
<html><body><script type="text/javascript">function employee(name,job,born){this.name=name;this.job=job;this.born=born;}var person=new employee("埃隆 马斯克","企业家",1981);document.write(person.toSource());</script></body></html>
输出: