简体   繁体   English

如何在 JS 中“重置”整个脚本?

[英]How to "reset" an entire script in JS?

Is there a method to return the an entire JS script to its original form?有没有一种方法可以将整个 JS 脚本返回到其原始形式? I've got a script for a quiz I'm writing, and by the end of it the arrays are shuffled and shifted and some other variables are changed as well.我有一个我正在编写的测验的脚本,在它结束时,数组被打乱和移位,其他一些变量也被更改。 Is there some way to just reset the entire thing to how it was at the beginning?有什么方法可以将整个事情重置为开始时的状态吗?

您可以通过重置所有变量手动执行此操作,也可以使用存储数据的类(然后丢弃实例并创建新实例)或仅重新加载页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM