gpt4 book ai didi

javascript - uneval() 和 .toSource() 有什么区别

转载 作者:数据小太阳 更新时间:2023-10-29 04:51:18 27 4
gpt4 key购买 nike

uneval(...).toSource() 有什么区别?

The toSource() method returns a string representing the source code of the object.

The uneval() method creates an string representation of the source code of an Object.

最佳答案

一个接受参数,另一个不接受。这似乎是唯一的区别,尽管不鼓励同时使用两者。

uneval(object);

Object.toSource();
obj.toSource();

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toSource

直接来自上述网站:

Non-standard

This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

我会远离这个功能。可能有更好的方法来完成您想要做的事情。

关于javascript - uneval() 和 .toSource() 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20802045/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com