i m confused working with javascript arrays

This question already has an answer here:

  • Is JavaScript a pass-by-reference or pass-by-value language? 29 answers

  • y[..] = ... is modifying an existing object. That change is visible to anything that holds a reference to that object.

    y = ... assigns an entirely new value to the local y variable and discards the previously assigned object reference. That change is not visible outside the function since nothing else has access to the y variable.

    链接地址: http://www.djcxy.com/p/20812.html

    上一篇: JavaScript通过引用而不是值传递?

    下一篇: 即时通讯困惑与JavaScript数组工作