0
私もJavaでその無名関数を読んで、それがabove.Iは、次の例で混乱しています意味を囲む関数内で新しいスコープが導入されていますは匿名関数が動的スコープですか?ラムダ式は、ブロックlocal.Doesあるのに対し、
var timer = {
seconds: 0,
start() {
setInterval(() => {
this.seconds++
}, 1000)
}
}
// When an item is searched, it starts from the anonymous function
// and this doesn't mean the same as parent this.
// This means that we can access this .seconds by first going to
// its enclosing function in the arrow expression.
timer.start()
setTimeout(function() {
console.log(timer.seconds)
}, 3500)
ここでこれを。それが匿名関数であれば、囲み関数内でこれの新しいスコープが導入されます。そうでしょうか? Static (Lexical) Scoping vs Dynamic Scoping (Pseudocode)
'this 'キーワードは、あなたが探しているものであれば"スコープ "と呼ばれません。 – Bergi
「無名関数」と「ラムダ式」とはどういう意味ですか?関数式と矢印関数はどちらも匿名である可能性があります。 – Bergi
親切に私に何かを説明してください –