Skip to content

Commit

Permalink
🐞 fix(*): 修改部署失败bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrickill committed Apr 17, 2024
1 parent bc366e3 commit 6149ab9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "astro preview",
"astro": "astro"
},
"engines": {
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ for (var i=1;i<5;i++)
{
console.log(j);
},j1000);
}
``````````````

在上面的示例中,每次for循环都创建了一个新的作用域然后用j对每个闭包所引用的(保存)作用域进行了绑定,使得每个settimeout的闭包都有正确的j以供访问,不同于var的单单创建赋值,如果使用了var的话,由于回调函数是在循环执行后做的,那么每个闭包引用的作用域中的j都是5了
Expand Down

0 comments on commit 6149ab9

Please sign in to comment.