You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
213 B
19 lines
213 B
4 months ago
|
// 让函数中声明的变量常驻内存
|
||
|
|
||
|
function fun(){
|
||
|
let i=99;
|
||
|
add=function () {
|
||
|
i+=1;
|
||
|
}
|
||
|
return ()=>{console.log(i)}
|
||
|
}
|
||
|
|
||
|
let sss=fun()
|
||
|
|
||
|
sss()
|
||
|
|
||
|
add()
|
||
|
|
||
|
sss()
|
||
|
|
||
|
console.log((sss.length))
|