请有人可以解释第二个方括号符号在这里做什么?

Please can someone explain what the second square bracket notation is doing here?

function(today) {
    var weekFromToday = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000); 
    var dayNames = ["x","y", "z"]; 
    var day = dayNames[weekFromToday.getDay()]; 
}

第三个变量中的方括号不是指索引号,在这种情况下符号是什么意思?

它的工作方式与通过索引访问的任何其他数组值一样。

这里 weekFromToday.getDay() returns 一个 0-6 的整数 如果

var dayNames = ["x","y", "z"]; 

var dayNames = ["Sun","Mon", "Tue"...]; 

你会收到当天的名字。