How do I pass variables by reference in JavaScript?(如何在JavaScript中通过引用传递变量?)
I have 3 variables that I want to perform several operations to, so I want to put them in a for loop and perform the operations to each one.(我有3个变量,我想对它们执行几个操作,因此我想将它们放在for循环中并对每个变量执行操作。)
pseudo code:(伪代码:)
myArray = new Array(var1, var2, var3);
for (var x = 0; x < myArray.length; x++){
//do stuff to the array
makePretty(myArray[x]);
}
//now do stuff to the updated vars
What is the best way to do this?(做这个的最好方式是什么?)
ask by BFTrick translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…