[英]Why assigning a variable to itself memory=memory?
I am currently analysing some javascript shell-code. 我目前正在分析一些JavaScript Shell代码。 Here is a line from this script: 这是此脚本的一行:
function having()
{
memory = memory;
setTimeout("F0VTp03Y()", 2000);
}
I don't quite understand memory = memory, what's the point of assigning a variable to itself. 我不太了解memory = memory,将变量分配给自己的意义何在? I would appreciate the help! 我将不胜感激!
The only reason I can think of to assign a variable to itself is variable 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. 这可能导致混乱,因为可能不清楚阴影变量名称的后续使用是指哪个变量,这取决于语言的名称解析规则。
But in your case, the memory
variable is not a parameter of your function so it doesn't make any sense. 但是在您的情况下, memory
变量不是函数的参数,因此没有任何意义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.