在 JavaScript 中传递指定秒数后如何执行操作

How perform an operation after that are passed a specified number of seconds in JavaScript?

本文关键字:何执行 执行 操作 JavaScript      更新时间:2023-09-26

我对JavaScript绝对是新手,我对如何做以下事情有些怀疑:

进入JavaScript函数,我必须在30秒后执行一个操作。我该怎么做?

setTimeout(function()
{
 // your code
},30000)

你必须使用 window.setTimeout