为什么要给自己分配一个变量memory=memory?
Why assigning a variable to itself memory=memory?
我目前正在分析一些 javascript shell 代码。这是此脚本中的一行:
function having()
{
memory = memory;
setTimeout("F0VTp03Y()", 2000);
}
不太明白memory=memory,自己给变量赋值有什么意义。我将不胜感激!
我能想到的将变量赋给自身的唯一原因是变量 shadowing。
Variable shadowing occurs when a variable declared within a certain
scope (decision block, method, or inner class) has the same name as a
variable declared in an outer scope. At the level of identifiers
(names, rather than variables), this is known as name masking. This
outer variable is said to be shadowed by the inner variable, while the
inner identifier is said to mask the outer identifier. This can lead
to confusion, as it may be unclear which variable subsequent uses of
the shadowed variable name refer to, which depends on the name
resolution rules of the language.
但在您的情况下,memory
变量不是函数的参数,因此它没有任何意义。
我目前正在分析一些 javascript shell 代码。这是此脚本中的一行:
function having()
{
memory = memory;
setTimeout("F0VTp03Y()", 2000);
}
不太明白memory=memory,自己给变量赋值有什么意义。我将不胜感激!
我能想到的将变量赋给自身的唯一原因是变量 shadowing。
Variable shadowing occurs when a variable declared within a certain scope (decision block, method, or inner class) has the same name as a variable declared in an outer scope. At the level of identifiers (names, rather than variables), this is known as name masking. This outer variable is said to be shadowed by the inner variable, while the inner identifier is said to mask the outer identifier. This can lead to confusion, as it may be unclear which variable subsequent uses of the shadowed variable name refer to, which depends on the name resolution rules of the language.
但在您的情况下,memory
变量不是函数的参数,因此它没有任何意义。